
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
django-envconfig
Advanced tools
Configure Django using environment variables (envvars). settings.py optional.
python -m pip install django-envconfig
Edit the manage.py, asgi.py and wsgi.py files generated by Django's
startproject command and modify the following line:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'envconfig.settings')
The following envvars are required (if settings.py is removed):
ALLOWED_HOSTS (unless you set DEBUG=on)Environments may be stored in an .env file. This file can be stored in your
root directory (next to manage.py) or anywhere on the path (e.g. virtualenv
directory).
Any Django setting can be configured as an environment variable.
true|yes|on|1 and false|no|off|0 (case-insensitive)None: none|null (case-insensitive)export ALLOWED_HOSTS=127.0.0.1,localhostSettings are loaded with the following priority (highest first):
settings.py, if it exists. Note: any
custom settings should be defined here with their default value.settings.py file generated by
startproject. This should eliminate the need for the file in (2) for most
projects. Caveats:
DEBUG has been changed to False.SECRET_KEY is generated but will not persist between sessions (e.g.
if you restart your server/process manager). Check the
Django documentation
to see whether you need to set a persistent SECRET_KEY as an
environment variable.Helper environment variables to use with django-envconfig:
| Environment variable | Description |
|---|---|
DJANGO_PROJECT | May be required if django-envconfig cannot find your project. Set to the name of the module originally generated by startproject |
ADD_INSTALLED_APPS | Add to INSTALLED_APPS |
REMOVE_INSTALLED_APPS | Remove from INSTALLED_APPS |
ADD_MIDDLEWARE | Add to MIDDLEWARE |
REMOVE_MIDDLEWARE | Remove from MIDDLEWARE |
If you are using a PostgreSQL backend you do not need to set DATABASES. You
can simply set PostgreSQL environment variables - the minimum is PGDATABASE.
See the
PostgreSQL docs
for the full list of envvars. This way the same environment can be used when
calling
PostgreSQL command line utilities
such as psql or pg_dump.
settings.py up to date between Django versions.MIT.
FAQs
Configure Django using environment variables.
We found that django-envconfig demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.