Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Thumbs.db
Desktop.ini

# Project settings
./site/
/site/
8 changes: 8 additions & 0 deletions src/manage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#!/usr/bin/env python
from os.path import dirname, join, exists
import os
import sys

import environ

env = environ.Env()
env_file = join(dirname(__file__), '{{ project_name }}/settings/' 'local.env')
if exists(env_file):
environ.Env.read_env(str(env_file))

if __name__ == "__main__":
# CHANGED manage.py will use development settings by
# default. Change the DJANGO_SETTINGS_MODULE environment variable
Expand Down
14 changes: 5 additions & 9 deletions src/project_name/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from os.path import dirname, join

from django.contrib import messages
from django.core.urlresolvers import reverse_lazy
from os.path import dirname, join, exists
import environ


# Build paths inside the project like this: join(BASE_DIR, "directory")
BASE_DIR = dirname(dirname(dirname(__file__)))
Expand Down Expand Up @@ -42,15 +46,8 @@
]

# Use 12factor inspired environment variables or from a file
import environ
env = environ.Env()

# Ideally move env file should be outside the git repo
# i.e. BASE_DIR.parent.parent
env_file = join(dirname(__file__), 'local.env')
if exists(env_file):
environ.Env.read_env(str(env_file))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

Expand Down Expand Up @@ -127,7 +124,6 @@
CRISPY_TEMPLATE_PACK = 'bootstrap3'

# For Bootstrap 3, change error alert to 'danger'
from django.contrib import messages
MESSAGE_TAGS = {
messages.ERROR: 'danger'
}
Expand Down
12 changes: 10 additions & 2 deletions src/project_name/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
from os.path import dirname, join, exists
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings.production")

from django.conf import settings
from django.core.wsgi import get_wsgi_application
import environ
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings.production")

env = environ.Env()
env_file = join(dirname(__file__), 'settings/' 'local.env')
if exists(env_file):
environ.Env.read_env(str(env_file))

application = get_wsgi_application()

# Wrap werkzeug debugger if DEBUG is on
from django.conf import settings
if settings.DEBUG:
try:
import django.views.debug
Expand Down