Skip to content

Commit

Permalink
Add Django-dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
skorokithakis committed Mar 21, 2018
1 parent bba0e87 commit bb853e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ yapf = "*"

django = "*"
django-extensions = "*"
django-dotenv = "*"
django-redis = "*"
"psycopg2-binary" = "*"
pytest = "*"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ provide a useful setup. Most of my projects are deployed to Heroku, so this is o
- Latest Django (hopefully).
- Uses [Pipenv](https://github.com/kennethreitz/pipenv) - the best packaging tool.
- [django-extensions](http://django-extensions.readthedocs.org) for the various useful commands and things.
- [Django-dotenv](https://github.com/jpadilla/django-dotenv), so you can easily set environment variables and access
them in your settings file.
- [ShortUUID](https://github.com/skorokithakis/shortuuid), because I end up using it most of the time.
- Secure by default (various things won't work on production without TLS).
- Runs under docker-compose by default, with a PostgreSQL and Redis instance (configured as a cache and session
Expand Down
4 changes: 4 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
import os
import sys

import dotenv

if __name__ == "__main__":
dotenv.read_dotenv()

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
try:
from django.core.management import execute_from_command_line
Expand Down
3 changes: 3 additions & 0 deletions project_name/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@

import os

import dotenv
from django.core.wsgi import get_wsgi_application

dotenv.read_dotenv(os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env'))

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")

application = get_wsgi_application()

0 comments on commit bb853e7

Please sign in to comment.