Changeset - ab6de89ec914
[Not reviewed]
default
0 1 2
Branko Majic (branko) - 12 years ago 2013-08-17 17:15:58
branko@majic.rs
DMT-1: Created separate configuration file for the production environment. Pulled-out a number of settings outside of base config into production config. Pulled out the credentials settings into separate file.
3 files changed with 76 insertions and 34 deletions:
0 comments (0 inline, 0 general) First comment
project/project_name/settings/base.py
Show inline comments
 
# 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',
project/project_name/settings/production.py
Show inline comments
 
new file 100644
 
# 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'
project/project_name/settings/sample_credentials.py
Show inline comments
 
new file 100644
 
# 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': '',
 
    }
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now