Change the django settings.py file to get configuration settings from
authorDiane Trout <diane@caltech.edu>
Fri, 29 Aug 2008 19:57:49 +0000 (19:57 +0000)
committerDiane Trout <diane@caltech.edu>
Fri, 29 Aug 2008 19:57:49 +0000 (19:57 +0000)
an ini-like file. Currently it searches, ~/.htsworkflow and
/etc/htsworkflow.ini.

Currently I only implemented the most basic settings overrides needed to
run a django server in development mode.

htswfrontend/htswfrontend/settings.py

index cd517430996a390ca27fff74ab26e4bdaa1de631..e48fb055a7db0b102ab7450a746e2e1034d0b10e 100644 (file)
@@ -1,5 +1,19 @@
+import ConfigParser
+
 import os
 
+# define your defaults here
+options = ConfigParser.SafeConfigParser(
+           { 'email_host': 'myerslab.stanford.edu',
+             'email_port': '25', 
+             'database_engine': 'sqlite3',
+             'database_name': 
+               os.path.abspath('/htsworkflow/htswfrontend/dev_fctracker.db'),
+           })
+
+options.read([os.path.expanduser("~/.htsworkflow.ini"),
+              '/etc/htsworkflow.ini',])
+
 # Django settings for elandifier project.
 
 DEBUG = True
@@ -11,11 +25,14 @@ ADMINS = (
 
 MANAGERS = ADMINS
 
-EMAIL_HOST = 'myerslab.stanford.edu'
-EMAIL_PORT = 25
+EMAIL_HOST = options.get('frontend', 'email_host')
+EMAIL_PORT = int(options.get('frontend', 'email_port'))
+
+# 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+DATABASE_ENGINE = options.get('frontend', 'database_engine')
 
-DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
-DATABASE_NAME = os.path.abspath('/htsworkflow/htswfrontend/dev_fctracker.db') # Or path to database file if using sqlite3.
+# Or path to database file if using sqlite3.
+DATABASE_NAME = options.get('frontend', 'database_name' )
 DATABASE_USER = ''             # Not used with sqlite3.
 DATABASE_PASSWORD = ''         # Not used with sqlite3.
 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.