From: Diane Trout Date: Fri, 29 Aug 2008 19:57:49 +0000 (+0000) Subject: Change the django settings.py file to get configuration settings from X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=b8f6488ca5cd55b1bcbfb126ed5796ac8d102200 Change the django settings.py file to get configuration settings from 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. --- diff --git a/htswfrontend/htswfrontend/settings.py b/htswfrontend/htswfrontend/settings.py index cd51743..e48fb05 100644 --- a/htswfrontend/htswfrontend/settings.py +++ b/htswfrontend/htswfrontend/settings.py @@ -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.