Skip to main content

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.

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

  1. First release.

v0.1.1

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

v0.2.0

  1. Add collect_requirements function. Removed

v0.2.1

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

v0.2.2

  1. Output sorting.

v0.2.3

  1. Remove collect_requirements command.
  2. Test with Django 3.2.

v0.2.4

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

v0.2.5

  1. Fix bdist_wheel problem that including useless files.

v0.3.0

  1. Rename add_app_requires to load_app_requires.
  2. Add load_app_middleware_requires.
  3. Add load_app_setting_defaults.
  4. Add load_app_setting_callbacks.
  5. Add patch_all to load_app_requires, load_app_middleware_requires, load_app_setting_defaults and load_app_setting_callbacks.

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.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

django_app_requires-0.3.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file django-app-requires-0.3.0.tar.gz.

File metadata

  • Download URL: django-app-requires-0.3.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for django-app-requires-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9154e3cbe869fd99895e1b0ccdc68bcbbad0068e8bbaa126eaef6e339e493a01
MD5 19906f40c17b27e68d8ab4bc29e452fd
BLAKE2b-256 5cec65a62de03f95d46526375aab3811776b36e4bc26501bb338abb804c484e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_app_requires-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for django_app_requires-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 754efc0ce8ce34c1935b1051be605a4f10b2744a1d8ca7ba9c86a734636dfb25
MD5 306307080ac0b09cfd9598f0ae64f4e2
BLAKE2b-256 6403b3dc6eea94ad56a37a0e5912a728262354acb72aa30a309925f2e6630673

See more details on using hashes here.

Supported by

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