qlever-ui icon indicating copy to clipboard operation
qlever-ui copied to clipboard

Customization of Django settings via environment or settings_local.py

Open Qup42 opened this issue 6 months ago • 0 comments

Remove settings_secret.py and adds two new ways to customize the settings:

  • Set basic settings (SECRET_KEY, DEBUG, ALLOWED_HOSTS, CSRF_TRUSTED_ORIGINS, DATABASE_URL) with environment variables
  • Overwrite all settings using a local_settings.py

The environment variables can also read from a .env file (in a key value format). Each environment variable can also be set using a file. An environment variable, e.g. SECRET_KEY, can also be read from a file that is named like the environment variable plus the suffix _FILE, e.g. SECRET_KEY_FILE.

Customizing settings via settings_secret.py for SECRET_KEY and ALLOWED_HOSTS is still supported but deprecated. (There is also a change in behavior: the default SECRET_KEY is !!super_secret!! again instead of the accidentally commited local key.)settings_local.py should be used instead. For the migration all assignments to the default value should be deleted and the file renamed from settings_secret.py to settings_local.py.

Qup42 avatar Aug 16 '24 18:08 Qup42