-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Basic env config with django-environ and 12 Factor principles. closes #138
- Loading branch information
Showing
10 changed files
with
84 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-r base.txt | ||
-r test.txt | ||
django-debug-toolbar==3.2.2 | ||
django-debug-toolbar-template-profiler==2.0.2 | ||
|
||
pre-commit==2.15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-r base.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-r base.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
{{cookiecutter.git_project_name}}/config/settings/production.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
"""Django production settings for {{cookiecutter.git_project_name}} project.""" | ||
|
||
from .base import * # noqa | ||
from django.conf import settings | ||
|
||
# Read from environment variables file | ||
environ.Env.read_env(os.path.join(BASE_DIR, ".env/.production")) | ||
|
||
SECRET_KEY = env("SECRET_KEY") | ||
|
||
DEBUG = env("DEBUG", default=False) | ||
|
||
ALLOWED_HOSTS = ["{{cookiecutter.ALLOWED_HOSTS}}"] | ||
|
||
# Check it is safe to run in producion. | ||
assert not settings.Debug, "DEBUG mode should be off for production." # nosec | ||
assert ( | ||
env("SECRET_KEY") != "!!!UNSECURE_PRODUCTION_SECRET!!!" | ||
), "SECRET_KEY must be set for production." # nosec |
18 changes: 18 additions & 0 deletions
18
{{cookiecutter.git_project_name}}/config/settings/staging.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
"""Django staging settings for {{cookiecutter.git_project_name}} project.""" | ||
|
||
from .base import * # noqa | ||
from django.conf import settings | ||
|
||
# Read from environment variables file | ||
environ.Env.read_env(os.path.join(BASE_DIR, ".env/.staging")) | ||
|
||
SECRET_KEY = env("SECRET_KEY") | ||
|
||
DEBUG = env("DEBUG", default=False) | ||
|
||
ALLOWED_HOSTS = ["{{cookiecutter.ALLOWED_HOSTS}}"] | ||
|
||
# Check it is safe to run in producion. | ||
assert not settings.Debug, "DEBUG mode should be off for production." # nosec | ||
assert ( | ||
env("SECRET_KEY") != "!!!UNSECURE_STAGING_SECRET!!!" | ||
), "SECRET_KEY must be set for production." # nosec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters