2 Generate settings for the Django Application.
4 To make it easier to customize the application the settings can be
5 defined in a configuration file read by ConfigParser.
7 The options understood by this module are (with their defaults):
12 database_engine=sqlite3
13 database_name=/path/to/db
22 [allowed_analysis_hosts]
32 __docformat__ = "restructuredtext en"
34 def options_to_list(options, dest, section_name, option_name):
36 Load a options from section_name and store in a dictionary
38 if options.has_option(section_name, option_name):
39 opt = options.get(section_name, option_name)
40 dest.extend( shlex.split(opt) )
42 def options_to_dict(dest, section_name):
44 Load a options from section_name and store in a dictionary
46 if options.has_section(section_name):
47 for name in options.options(section_name):
48 dest[name] = options.get(section_name, name)
50 # define your defaults here
51 options = ConfigParser.SafeConfigParser(
52 { 'email_host': 'localhost',
54 'database_engine': 'sqlite3',
56 os.path.abspath('../../fctracker.db'),
57 'time_zone': 'America/Los_Angeles',
59 'link_flowcell_storage_device_url': "http://localhost:8000/inventory/lts/link/",
60 'printer1_host': '127.0.0.1',
61 'printer1_port': '9100',
62 'printer2_host': '127.0.0.1',
63 'printer2_port': '9100',
66 options.read([os.path.expanduser("~/.htsworkflow.ini"),
67 '/etc/htsworkflow.ini',])
69 # OptionParser will use the dictionary passed into the config parser as
70 # 'Default' values in any section. However it still needs an empty section
71 # to exist in order to retrieve anything.
72 if not options.has_section('frontend'):
73 options.add_section('frontend')
74 if not options.has_section('bcprinter'):
75 options.add_section('bcprinter')
78 # Django settings for elandifier project.
81 TEMPLATE_DEBUG = DEBUG
84 options_to_list(options, ADMINS, 'frontend', 'admins')
87 options_to_list(options, MANAGERS, 'frontend', 'managers')
89 AUTHENTICATION_BACKENDS = ( 'samples.auth_backend.HTSUserModelBackend', )
90 CUSTOM_USER_MODEL = 'samples.HTSUser'
92 EMAIL_HOST = options.get('frontend', 'email_host')
93 EMAIL_PORT = int(options.get('frontend', 'email_port'))
95 if options.has_option('frontend', 'notification_sender'):
96 NOTIFICATION_SENDER = options.get('frontend', 'notification_sender')
98 NOTIFICATION_SENDER = "noreply@example.com"
100 # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
101 DATABASE_ENGINE = options.get('frontend', 'database_engine')
103 # Or path to database file if using sqlite3.
104 DATABASE_NAME = options.get('frontend', 'database_name' )
105 DATABASE_USER = '' # Not used with sqlite3.
106 DATABASE_PASSWORD = '' # Not used with sqlite3.
107 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
108 DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
110 # Local time zone for this installation. Choices can be found here:
111 # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
112 # although not all variations may be possible on all operating systems.
113 # If running in a Windows environment this must be set to the same as your
115 TIME_ZONE = options.get('frontend', 'time_zone')
117 # Language code for this installation. All choices can be found here:
118 # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
119 # http://blogs.law.harvard.edu/tech/stories/storyReader$15
120 LANGUAGE_CODE = 'en-us'
124 # If you set this to False, Django will make some optimizations so as not
125 # to load the internationalization machinery.
128 # Absolute path to the directory that holds media.
129 # Example: "/home/media/media.lawrence.com/"
130 MEDIA_ROOT = os.path.abspath(os.path.split(__file__)[0]) + '/static/'
132 # URL that handles the media served from MEDIA_ROOT.
133 # Example: "http://media.lawrence.com"
134 MEDIA_URL = '/static/'
136 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
138 # Examples: "http://foo.com/media/", "/media/".
139 ADMIN_MEDIA_PREFIX = '/media/'
141 # Make this unique, and don't share it with anybody.
142 SECRET_KEY = '(ekv^=gf(j9f(x25@a7r+8)hqlz%&_1!tw^75l%^041#vi=@4n'
144 # some of our urls need an api key
145 DEFAULT_API_KEY = 'n7HsXGHIi0vp9j5u4TIRJyqAlXYc4wrH'
147 # List of callables that know how to import templates from various sources.
149 'django.template.loaders.filesystem.load_template_source',
150 'django.template.loaders.app_directories.load_template_source',
151 # 'django.template.loaders.eggs.load_template_source',
154 MIDDLEWARE_CLASSES = (
155 'django.middleware.common.CommonMiddleware',
156 'django.contrib.sessions.middleware.SessionMiddleware',
157 'django.contrib.auth.middleware.AuthenticationMiddleware',
158 'django.middleware.doc.XViewMiddleware',
161 ROOT_URLCONF = 'htsworkflow.frontend.urls'
164 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
165 # Always use forward slashes, even on Windows.
166 # Don't forget to use absolute paths, not relative paths.
167 '/usr/share/python-support/python-django/django/contrib/admin/templates',
168 #'/usr/lib/pymodules/python2.6/django/contrib/admin/templates/',
169 os.path.join(os.path.split(__file__)[0], 'templates'),
173 'django.contrib.admin',
174 'django.contrib.auth',
175 'django.contrib.contenttypes',
176 'django.contrib.humanize',
177 'django.contrib.sessions',
178 'django.contrib.sites',
179 'htsworkflow.frontend.eland_config',
180 'htsworkflow.frontend.samples',
181 # modules from htsworkflow branch
182 'htsworkflow.frontend.experiments',
183 'htsworkflow.frontend.analysis',
184 'htsworkflow.frontend.reports',
185 'htsworkflow.frontend.inventory',
186 'htsworkflow.frontend.bcmagic',
187 'django.contrib.databrowse',
190 # Project specific settings
192 ALLOWED_IPS={'127.0.0.1': '127.0.0.1'}
193 options_to_dict(ALLOWED_IPS, 'allowed_hosts')
195 ALLOWED_ANALYS_IPS = {'127.0.0.1': '127.0.0.1'}
196 options_to_dict(ALLOWED_ANALYS_IPS, 'allowed_analysis_hosts')
197 #UPLOADTO_HOME = os.path.abspath('../../uploads')
198 #UPLOADTO_CONFIG_FILE = os.path.join(UPLOADTO_HOME, 'eland_config')
199 #UPLOADTO_ELAND_RESULT_PACKS = os.path.join(UPLOADTO_HOME, 'eland_results')
200 #UPLOADTO_BED_PACKS = os.path.join(UPLOADTO_HOME, 'bed_packs')
201 RESULT_HOME_DIR=os.path.expanduser('~/proj/solexa/results/flowcells')
203 LINK_FLOWCELL_STORAGE_DEVICE_URL = options.get('frontend', 'link_flowcell_storage_device_url')
204 # PORT 9100 is default for Zebra tabletop/desktop printers
205 # PORT 6101 is default for Zebra mobile printers
206 BCPRINTER_PRINTER1_HOST = options.get('bcprinter', 'printer1_host')
207 BCPRINTER_PRINTER1_PORT = int(options.get('bcprinter', 'printer1_port'))
208 BCPRINTER_PRINTER2_HOST = options.get('bcprinter', 'printer2_host')
209 BCPRINTER_PRINTER2_PORT = int(options.get('bcprinter', 'printer2_port'))