Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

✨ Load Django Settings from Environmental Variables with One Magical Line of Code

License

NotificationsYou must be signed in to change notification settings

DanielJDufour/djenv

Repository files navigation

Load Django Settings Directly from Environmental Variables

features

  • modify django configuration without modifying source code
  • prevent hard-coding of Django settings
  • works great with Docker

install

with pip

pip install djenv

with pipenv

pipenv install djenv

basic usage

# inside settings.py# import settings from environmentfromdjenv.settingsimport*

Prepend Settings withDJANGO_ to import them. For example:

DJANGO_DEBUG=False python3 manage.py runserver

Will set DEBUG=False in the settings.py

advanced usage

You can also replace nested settings like DATABASES by setting a JSON

DJANGO_DATABASES='{ "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": "db.sqlite3" } }'  python3 manage.py runserver

About

✨ Load Django Settings from Environmental Variables with One Magical Line of Code

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp