Skip to main content

A simple Django app that allows you to specify app dependencies and middleware dependencies in your own apps, and also add defaults for additional configurations.

Project description

django-app-requires

A simple tool that allows you to specify app dependencies and middleware dependencies in your application, and also allow you to add default values for your additional configurations, after then load all your application settings into your project's settings.

Install

pip install django-app-requires

Usage

your_app/__init__.py

app_requires = [
    "your",
    "required",
    "apps",
]

app_middleware_requires = [
    "your",
    "required",
    "middlewares",
]

# Django's setting key must be in upper case.
# default values will be overrided by items in pro/settings.py.

app_setting_defaults = {
    "HELLO": "WORLD",
}

app_setting_callbacks = {
    "your_app.setting_callbacks.callback1",
}

your_app/setting_callbacks.py

def callback1(globals):
    globals["EXTRA_ITEM"] = "EXTRA_VALUE"

pro/settings

INSTALLED_APPS = [
    ...
    'your_app',
    ...
]

#
# at the bottom of settings.py
#
from django_app_requires import patch_all
patch_all()

# so the final INSTALLED_APPS = [
#     "your",
#     "required",
#     "apps",
#     "your_app",
#     "django_app_requires",
# ]

# so the final MIDDLEWARE = [
#    ...
#    "your",
#    "required",
#    "middlewares",
#    ...
# ]

# so the final you got a new setting item:
# HELLO = "WORLD"

## so the final you got a new setting item which provided by callback1:
# EXTRA_ITEM = "EXTRA_VALUE"

Releases

v0.1.0

  • First release.

v0.1.1

  • Add fastutils & magic-import in requirements.txt.
  • Fix problems of recursive required.

v0.2.0

  • Add collect_requirements function. Removed

v0.2.1

  • Don't scan all app, exclude third-part apps.
  • Suggest to use collect_requirements command before doing project package.

v0.2.2

  • Output sorting.

v0.2.3

  • Remove collect_requirements command.
  • Test with Django 3.2.

v0.2.4

  • We are not care about Django's version and fastutils' version, so let the end user to choose the version.

v0.2.5

  • Fix bdist_wheel problem that including useless files.

v0.3.0

  • Rename add_app_requires to load_app_requires.
  • Add load_app_middleware_requires.
  • Add load_app_setting_defaults.
  • Add load_app_setting_callbacks.
  • Add patch_all to load_app_requires, load_app_middleware_requires, load_app_setting_defaults and load_app_setting_callbacks.

v0.3.1

  • Fix app_setting_callbacks duplicate load problem.

v0.3.2

  • Doc update.
  • Use zenutils.

v0.3.3

  • Doc update.

v0.3.4

  • Fix unit tests.

v0.3.5

  • Doc update.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_app_requires-0.3.5.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_app_requires-0.3.5-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file django_app_requires-0.3.5.tar.gz.

File metadata

  • Download URL: django_app_requires-0.3.5.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for django_app_requires-0.3.5.tar.gz
Algorithm Hash digest
SHA256 767a33e215764bf3cc59ddb414a45093fc3b15a4cfe17eb4a0ea93cca110cbd9
MD5 5180a15fde78455d92b35136a8f271a7
BLAKE2b-256 7d82870868fb9e316fb32ab87d2c02567985312b27e279fbdf85eeb855e276af

See more details on using hashes here.

File details

Details for the file django_app_requires-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_app_requires-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 522147aa5e28fc250ffee1f6730b66d052ab5e546d4e8813585959cc622af9b8
MD5 79a83e41dd36d3d084dbeb2e06f3ea16
BLAKE2b-256 f0af0255b804772037951520457c1dc9d150cc9613902c6082b5e836455f1336

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page