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
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-app-requires-0.3.1.tar.gz
.
File metadata
- Download URL: django-app-requires-0.3.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fe8aaf7b5b82b45d45070fdde38cf0e16045ca9a348bb19f6ff0bea2e4e491d |
|
MD5 | ffdf6977ff4396e1219a4d9ba0563481 |
|
BLAKE2b-256 | afe13480445e41c77dbae7efdcfb9720bc09d255408167cbfd50d531fae4c6cf |
File details
Details for the file django_app_requires-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: django_app_requires-0.3.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d56111bc1c482d130e64eeba95227698780317f2eba584e6a59c071d411be9c |
|
MD5 | 6dfd1247b08e37a7035f965a615f3b9d |
|
BLAKE2b-256 | 67f41a42fde6ad591066da4e13b73fef368bebbda732feb6a3e9ea915261d81d |