From 6766edae0f027f1ac392b11e62dbb4485000a58b Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 18 Oct 2010 13:42:12 +0200 Subject: [PATCH] settings: Make dbsettings and localsettings external to settings.py This allows keeping those settings out of version control and modifiable per installation. --- dbsettings.py.tmpl | 9 +++++++++ localsettings.py.tmpl | 6 ++++++ settings.py | 16 ++++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 dbsettings.py.tmpl create mode 100644 localsettings.py.tmpl diff --git a/dbsettings.py.tmpl b/dbsettings.py.tmpl new file mode 100644 index 0000000..bf6ae6e --- /dev/null +++ b/dbsettings.py.tmpl @@ -0,0 +1,9 @@ +# Database settings. Put here to keep them out of version control. We +# don't want sensitive data in there, and database settings might vary +# per deployment +DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. +DATABASE_NAME = 'ee_bookings' # Or path to database file if using sqlite3. +DATABASE_USER = 'ee_bookings' # Not used with sqlite3. +DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. diff --git a/localsettings.py.tmpl b/localsettings.py.tmpl new file mode 100644 index 0000000..58a4544 --- /dev/null +++ b/localsettings.py.tmpl @@ -0,0 +1,6 @@ +# Put any settings that are specific to this installation in here. +# Any settings from settings.py can be overridden. + +# For example, enable debugging by commenting in the following lines. +#DEBUG = True +#TEMPLATE_DEBUG = True diff --git a/settings.py b/settings.py index 359d086..98be51f 100644 --- a/settings.py +++ b/settings.py @@ -14,12 +14,9 @@ ADMINS = ( MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = 'db.db' # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. +# Import database settings from a default file (so we can keep those out +# of git). +from dbsettings import * # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name @@ -80,3 +77,10 @@ TEMPLATE_DIRS = ( INSTALLED_APPS = ( 'tickets', ) + +# Import local settings, that are specific to this installation. These +# can override any settings specified here. +try: + from localsettings import * +except ImportError: + pass -- 2.30.2