djangofloor.scripts
¶
“Main” functions for Django, Celery, Gunicorn and uWSGI¶
Define “main” functions for your scripts using the Django manage.py system or Gunicorn/Celery/uWSGI.
-
class
djangofloor.scripts.
DjangoCommand
[source]¶ Main function, calling Django code for management commands. Retrieve some default values from Django settings.
-
commands
= None¶
-
-
class
djangofloor.scripts.
GunicornCommand
[source]¶ wrapper around gunicorn. Retrieve some default values from Django settings.
Returns:
-
djangofloor.scripts.
control
()[source]¶ A single command to rule them all… Replace django, gunicorn/aiohttp and celery commands. “myproject-ctl” command
“worker” -> changed as “myproject-celery” “worker” “server” -> changed as “myproject-aiohttp” “celery” -> changed as “myproject-celery” command other value -> changed as “myproject-django” command
-
djangofloor.scripts.
get_application
(command_name: typing.Union[str, NoneType] = None, script_name: typing.Union[str, NoneType] = None)[source]¶
-
djangofloor.scripts.
get_merger_from_env
() → djangofloor.conf.merger.SettingMerger[source]¶ Should be used after set_env(); determine all available settings in this order:
- djangofloor.defaults
- {project_name}.defaults (overrides djangofloor.defaults)
- {root}/etc/{project_name}/settings.ini (overrides {project_name}.settings)
- {root}/etc/{project_name}/settings.py (overrides {root}/etc/{project_name}/settings.ini)
- ./local_settings.ini (overrides {root}/etc/{project_name}/settings.py)
- ./local_settings.py (overrides ./local_settings.ini)
-
djangofloor.scripts.
load_celery
()[source]¶ Import Celery application unless Celery is disabled. Allow to automatically load tasks
-
djangofloor.scripts.
set_env
(command_name: typing.Union[str, NoneType] = None, script_name: typing.Union[str, NoneType] = None)[source]¶ Set the environment variable DF_CONF_NAME with the project name and the script name The value looks like “project_name:celery” or “project_name:django”
determine the project name
if the script is {xxx}-[gunicorn|manage][.py], then the project_name is assumed to be {xxx} if option –dfproject {xxx} is available, then the project_name is assumed to be {xxx}