Skip to content

Commit

Permalink
Consolidate settings and use env vars.
Browse files Browse the repository at this point in the history
settings/local.py can still be used for complex setting overrides but
environment variables is the preferred way to configure settings.
  • Loading branch information
Michael Kelly committed Apr 9, 2015
1 parent d5dbecd commit fa5c9e5
Show file tree
Hide file tree
Showing 6 changed files with 343 additions and 161 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,3 +22,4 @@ tmp/*
.vagrant
/env/
/static/
.env
4 changes: 4 additions & 0 deletions manage.py
Expand Up @@ -2,6 +2,10 @@
import os
import sys

# Read .env file and inject it's values into the environment
import dotenv
dotenv.read_dotenv()

# Edit this if necessary or override the variable in your environment.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')

Expand Down
6 changes: 6 additions & 0 deletions requirements.txt
Expand Up @@ -165,3 +165,9 @@ tower==0.4.1

# sha256: EeMy8qKdhkQ2S0ynm0rAed8yhibsjCesDozEVGlnGco
translate-toolkit==1.12.0
# sha256: 8uJz7TSsu1YJYtXPEpF5NtjfAil98JvTCJuFRtRYQTg
# sha256: ygF2j97N4TQwHzFwdDIm9g7f9cOTXxJDc3jr2RFQY1M
dj-database-url==0.3.0
# sha256: 3-W4wr5as0NbPXHlocZrsU2oEE2kTvDdjMw-ipJ2Ftk
# sha256: EgxGIdHk9a2r4KaDRj0b56WmuZLt1HZNMjxifSKSUeA
django-dotenv==1.3.0
5 changes: 3 additions & 2 deletions settings/__init__.py
@@ -1,6 +1,7 @@
from .base import *

# Import local settings if they exist (usually only in development).
try:
from .local import *
except ImportError, exc:
exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]])
raise exc
pass

0 comments on commit fa5c9e5

Please sign in to comment.