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]
31 __docformat__ = "restructuredtext en"
33 def options_to_list(dest, section_name):
35 Load a options from section_name and store in a dictionary
37 if options.has_section(section_name):
38 for name in options.options(section_name):
39 dest.append( options.get(section_name, name) )
41 def options_to_dict(dest, section_name):
43 Load a options from section_name and store in a dictionary
45 if options.has_section(section_name):
46 for name in options.options(section_name):
47 dest[name] = options.get(section_name, name)
49 # define your defaults here
50 options = ConfigParser.SafeConfigParser(
51 { 'email_host': 'localhost',
53 'database_engine': 'sqlite3',
55 os.path.abspath('/htsworkflow/htswfrontend/dev_fctracker.db'),
56 'time_zone': 'America/Los_Angeles',
58 'link_flowcell_storage_device_url': "http://localhost:8000/inventory/lts/link/",
59 'printer1_host': '127.0.0.1',
60 'printer1_port': '9100',
61 'printer2_host': '127.0.0.1',
62 'printer2_port': '9100',
65 options.read([os.path.expanduser("~/.htsworkflow.ini"),
66 '/etc/htsworkflow.ini',])
68 # OptionParser will use the dictionary passed into the config parser as
69 # 'Default' values in any section. However it still needs an empty section
70 # to exist in order to retrieve anything.
71 if not options.has_section('frontend'):
72 options.add_section('frontend')
73 if not options.has_section('bcprinter'):
74 options.add_section('bcprinter')
77 # Django settings for elandifier project.
80 TEMPLATE_DEBUG = DEBUG
83 options_to_list(ADMINS, 'admins')
87 AUTHENTICATION_BACKENDS = ( 'samples.auth_backend.HTSUserModelBackend', )
88 CUSTOM_USER_MODEL = 'samples.HTSUser'
90 EMAIL_HOST = options.get('frontend', 'email_host')
91 EMAIL_PORT = int(options.get('frontend', 'email_port'))
93 # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
94 DATABASE_ENGINE = options.get('frontend', 'database_engine')
96 # Or path to database file if using sqlite3.
97 DATABASE_NAME = options.get('frontend', 'database_name' )
98 DATABASE_USER = '' # Not used with sqlite3.
99 DATABASE_PASSWORD = '' # Not used with sqlite3.
100 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
101 DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
103 # Local time zone for this installation. Choices can be found here:
104 # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
105 # although not all variations may be possible on all operating systems.
106 # If running in a Windows environment this must be set to the same as your
108 TIME_ZONE = options.get('frontend', 'time_zone')
110 # Language code for this installation. All choices can be found here:
111 # http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
112 # http://blogs.law.harvard.edu/tech/stories/storyReader$15
113 LANGUAGE_CODE = 'en-us'
117 # If you set this to False, Django will make some optimizations so as not
118 # to load the internationalization machinery.
121 # Absolute path to the directory that holds media.
122 # Example: "/home/media/media.lawrence.com/"
123 MEDIA_ROOT = os.path.abspath(os.path.split(__file__)[0]) + '/static/'
125 # URL that handles the media served from MEDIA_ROOT.
126 # Example: "http://media.lawrence.com"
127 MEDIA_URL = '/static/'
129 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
131 # Examples: "http://foo.com/media/", "/media/".
132 ADMIN_MEDIA_PREFIX = '/media/'
134 # Make this unique, and don't share it with anybody.
135 SECRET_KEY = '(ekv^=gf(j9f(x25@a7r+8)hqlz%&_1!tw^75l%^041#vi=@4n'
137 # List of callables that know how to import templates from various sources.
139 'django.template.loaders.filesystem.load_template_source',
140 'django.template.loaders.app_directories.load_template_source',
141 # 'django.template.loaders.eggs.load_template_source',
144 MIDDLEWARE_CLASSES = (
145 'django.middleware.common.CommonMiddleware',
146 'django.contrib.sessions.middleware.SessionMiddleware',
147 'django.contrib.auth.middleware.AuthenticationMiddleware',
148 'django.middleware.doc.XViewMiddleware',
151 ROOT_URLCONF = 'htsworkflow.frontend.urls'
154 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
155 # Always use forward slashes, even on Windows.
156 # Don't forget to use absolute paths, not relative paths.
157 os.path.join(os.path.split(__file__)[0], 'templates'),
161 'django.contrib.admin',
162 'django.contrib.auth',
163 'django.contrib.contenttypes',
164 'django.contrib.humanize',
165 'django.contrib.sessions',
166 'django.contrib.sites',
167 'htsworkflow.frontend.eland_config',
168 'htsworkflow.frontend.samples',
169 # modules from htsworkflow branch
170 'htsworkflow.frontend.experiments',
171 'htsworkflow.frontend.analysis',
172 'htsworkflow.frontend.reports',
173 'htsworkflow.frontend.inventory',
174 'htsworkflow.frontend.bcmagic',
175 'htsworkflow.frontend.bcprinter',
176 'django.contrib.databrowse',
179 # Project specific settings
181 ALLOWED_IPS={'127.0.0.1': '127.0.0.1'}
182 options_to_dict(ALLOWED_IPS, 'allowed_hosts')
184 ALLOWED_ANALYS_IPS = {'127.0.0.1': '127.0.0.1'}
185 options_to_dict(ALLOWED_ANALYS_IPS, 'allowed_analysis_hosts')
186 #UPLOADTO_HOME = os.path.abspath('../../uploads')
187 #UPLOADTO_CONFIG_FILE = os.path.join(UPLOADTO_HOME, 'eland_config')
188 #UPLOADTO_ELAND_RESULT_PACKS = os.path.join(UPLOADTO_HOME, 'eland_results')
189 #UPLOADTO_BED_PACKS = os.path.join(UPLOADTO_HOME, 'bed_packs')
190 RESULT_HOME_DIR='/Users/diane/proj/solexa/results/flowcells'
192 LINK_FLOWCELL_STORAGE_DEVICE_URL = options.get('frontend', 'link_flowcell_storage_device_url')
193 # PORT 9100 is default for Zebra tabletop/desktop printers
194 # PORT 6101 is default for Zebra mobile printers
195 BCPRINTER_PRINTER1_HOST = options.get('bcprinter', 'printer1_host')
196 BCPRINTER_PRINTER1_PORT = int(options.get('bcprinter', 'printer1_port'))
197 BCPRINTER_PRINTER2_HOST = options.get('bcprinter', 'printer2_host')
198 BCPRINTER_PRINTER2_PORT = int(options.get('bcprinter', 'printer2_port'))