diff --git a/project/project_name/settings/base.py b/project/project_name/settings/base.py --- a/project/project_name/settings/base.py +++ b/project/project_name/settings/base.py @@ -1,35 +1,9 @@ -# Django settings for {{ project_name }} project. - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - # ('Your Name', 'your_email@example.com'), -) - -MANAGERS = ADMINS +# Base Django settings for {{ project_name }} project. -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': '', # Or path to database file if using sqlite3. - # The following settings are not used with sqlite3: - 'USER': '', - 'PASSWORD': '', - 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. - 'PORT': '', # Set to empty string for default. - } -} - -# Hosts/domain names that are valid for this site; required if DEBUG is False -# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts -ALLOWED_HOSTS = [] - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# In a Windows environment this must be set to your system time zone. -TIME_ZONE = 'America/Chicago' +# +# This file contains common settings shared amongst all instances of a +# project. Do not put any site-specific settings here. +# # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html @@ -82,9 +56,6 @@ STATICFILES_FINDERS = ( # 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) -# Make this unique, and don't share it with anybody. -SECRET_KEY = '{{ secret_key }}' - # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', diff --git a/project/project_name/settings/production.py b/project/project_name/settings/production.py new file mode 100644 --- /dev/null +++ b/project/project_name/settings/production.py @@ -0,0 +1,57 @@ +# Production site settings for {{ project_name }} project. + +# +# This configuration file is used to define settins for the production site. +# + +# Import the exception for signalling invalid configuration. No other +# Django-specific definitions should be imported here. +from django.core.exceptions import ImproperlyConfigured + +# Import the base settings. +from .base import * + +# Import the credentials. +try: + from .credentials import DATABASE_PASSWORDS +except ImportError: + raise ImproperlyConfigured("Please configure the DATABASE_PASSWORDS in credentials.py.") + +try: + from .credentials import SECRET_KEY +except ImportError: + raise ImproperlyConfigured("Please configure the SECRET_KEY in credentials.py.") + +# Disable Debug for production site. +DEBUG = False +TEMPLATE_DEBUG = DEBUG + +# Set-up the site administrators. +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) + +MANAGERS = ADMINS + +# Set-up the database settings. +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': '', # Or path to database file if using sqlite3. + # The following settings are not used with sqlite3: + 'USER': '', + 'PASSWORD': DATABASE_PASSWORDS['default'], + 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. + 'PORT': '', # Set to empty string for default. + } +} + +# Hosts/domain names that are valid for this site; required if DEBUG is False +# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts +ALLOWED_HOSTS = [] + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# In a Windows environment this must be set to your system time zone. +TIME_ZONE = 'Europe/Stockholm' diff --git a/project/project_name/settings/sample_credentials.py b/project/project_name/settings/sample_credentials.py new file mode 100644 --- /dev/null +++ b/project/project_name/settings/sample_credentials.py @@ -0,0 +1,14 @@ +# Sample credentials.py file. + +# +# This file contains a sample of how the site-specific credentials.py file +# should look like. +# + +# Make this unique, and don't share it with anybody. +SECRET_KEY = '' + +# Passwords for one or more databases used by the site. +DATABASE_PASSWORDS = { + 'default': '', + }