Skip to content

Commit

Permalink
fix(sample_project): use environment variables for Django settings
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jun 13, 2024
1 parent b1bb01f commit 7ddd8f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sample_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
SECRET_KEY = os.environ.get("SECRET_KEY", get_random_secret_key())
DEBUG = True

ALLOWED_HOSTS = ["*"]
# we look for values in the environment and fallback to the
# Django defaults if there are none set
env_ah = os.environ.get("DJANGO_ALLOWED_HOSTS", "").split(",")
ALLOWED_HOSTS = list(filter(None, env_ah))
env_csrf = os.environ.get("DJANGO_CSRF_TRUSTED_ORIGINS", "").split(",")
CSRF_TRUSTED_ORIGINS = list(filter(None, env_csrf))


# Application definition
Expand Down

0 comments on commit 7ddd8f2

Please sign in to comment.