Internals¶
Layout¶
myproject/__init__.py
env.py
security.py
security_FLEXI_RUN_ENV.py
settings.py
settings_FLEXI_RUN_ENV.py
env.pyhas a single variableFLEXI_RUN_ENVthat defines a running environment. This variable is then used to call different profiles of configuration depending on the running environment likedev,stageandprod. TheFLEXI_RUN_ENVvariable can also be set by environment, the environment takes precedence overenv.py. Example:$ export FLEXI_RUN_ENV='dev'; python manage.py runserver
security.pyholds all the common security variables for the project, probably a good place forSECRET_KEY.security_FLEXI_RUN_ENVspecific environment security variables, dedicated database passwords should go there. Setting defined here will override settings defined insecurity.py.settings.pythe classic settings file found in all django projects.settings_FLEXI_RUN_ENV.pygathers local settings for a given running environment, settings defined here will override settings defined insettings.py.
Loading order¶
The modules are loaded in the following order:
myproject/env.pymyproject/security.pymyproject/security_FLEXI_RUN_ENV.pymyproject/settings.pymyproject/settings_FLEXI_RUN_ENV.py
If the FLEXI_RUN_ENV variable is false in python, the only settings
files read are security.py and settings.py.