X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=htsworkflow%2Fsettings.py;h=ee1cb6a2a50a6a1489a46964fe8c9678625f0a20;hb=6d4095658be3e872dbfbb23f0a0b95eb7e396db9;hp=7af5ac484f5e612dde288e3e4519215a031c9e83;hpb=1986c5001aef28327bdfaa5c11b57f09387ba5db;p=htsworkflow.git diff --git a/htsworkflow/settings.py b/htsworkflow/settings.py index 7af5ac4..ee1cb6a 100644 --- a/htsworkflow/settings.py +++ b/htsworkflow/settings.py @@ -28,6 +28,7 @@ The options understood by this module are (with their defaults): """ import ConfigParser +import logging import os import shlex import htsworkflow @@ -37,6 +38,7 @@ from django.conf import global_settings from htsworkflow.util.api import make_django_secret_key HTSWORKFLOW_ROOT = os.path.abspath(os.path.split(htsworkflow.__file__)[0]) +LOGGER = logging.getLogger(__name__) # make epydoc happy __docformat__ = "restructuredtext en" @@ -100,8 +102,13 @@ AUTHENTICATION_BACKENDS = ( 'htsworkflow.frontend.samples.auth_backend.HTSUserModelBackend', ) CUSTOM_USER_MODEL = 'samples.HTSUser' -EMAIL_HOST = options.get('frontend', 'email_host', 'localhost') -EMAIL_PORT = int(options.get('frontend', 'email_port', 25)) +EMAIL_HOST='localhost' +if options.has_option('frontend', 'email_host'): + EMAIL_HOST = options.get('frontend', 'email_host') + +EMAIL_PORT = 25 +if options.has_option('frontend', 'email_port'): + EMAIL_PORT = int(options.get('frontend', 'email_port')) if options.has_option('frontend', 'notification_sender'): NOTIFICATION_SENDER = options.get('frontend', 'notification_sender') @@ -110,7 +117,11 @@ else: NOTIFICATION_BCC = [] options_to_list(options, NOTIFICATION_BCC, 'frontend', 'notification_bcc') -database_section = options.get('frontend', 'database', 'database') +if not options.has_option('frontend', 'database'): + raise ConfigParser.NoSectionError( + "Please define [frontend] database=
") + +database_section = options.get('frontend', 'database') if not options.has_section(database_section): raise ConfigParser.NoSectionError( @@ -132,6 +143,13 @@ if options.has_option(database_section, 'password_file'): elif options.has_option(database_section, 'password'): DATABASE_PASSWORD = options.get(database_section, 'password') +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': DATABASE_NAME, + } +} + # Local time zone for this installation. Choices can be found here: # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE # although not all variations may be possible on all operating systems. @@ -161,10 +179,9 @@ MEDIA_ROOT = os.path.join(HTSWORKFLOW_ROOT, 'frontend', 'static', '') # Example: "http://media.lawrence.com" MEDIA_URL = '/static/' -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# URL prefix for static media -- CSS, JavaScript and images. Make sure to use a # trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/media/' +STATIC_URL = '/media/' # Make this unique, and don't share it with anybody. if not options.has_option('frontend', 'secret'): @@ -177,16 +194,16 @@ DEFAULT_API_KEY = 'n7HsXGHIi0vp9j5u4TIRJyqAlXYc4wrH' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.load_template_source', - 'django.template.loaders.app_directories.load_template_source', -# 'django.template.loaders.eggs.load_template_source', + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', ) MIDDLEWARE_CLASSES = ( - 'django.contrib.csrf.middleware.CsrfMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.doc.XViewMiddleware', ) @@ -209,6 +226,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', + 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.sites', @@ -221,7 +239,6 @@ INSTALLED_APPS = ( 'htsworkflow.frontend.inventory', 'htsworkflow.frontend.bcmagic', 'htsworkflow.frontend.labels', - 'django.contrib.databrowse', ) # Project specific settings @@ -248,8 +265,16 @@ else: LINK_FLOWCELL_STORAGE_DEVICE_URL = None # PORT 9100 is default for Zebra tabletop/desktop printers # PORT 6101 is default for Zebra mobile printers -BCPRINTER_PRINTER1_HOST = options.get('bcprinter', 'printer1_host') -BCPRINTER_PRINTER1_PORT = int(options.get('bcprinter', 'printer1_port')) -BCPRINTER_PRINTER2_HOST = options.get('bcprinter', 'printer2_host') -BCPRINTER_PRINTER2_PORT = int(options.get('bcprinter', 'printer2_port')) +BCPRINTER_PRINTER1_HOST = None +if options.has_option('bcprinter', 'printer1_host'): + BCPRINTER_PRINTER1_HOST = options.get('bcprinter', 'printer1_host') +BCPRINTER_PRINTER1_PORT=9100 +if options.has_option('bcprinter', 'printer1_port'): + BCPRINTER_PRINTER1_PORT = int(options.get('bcprinter', 'printer1_port')) +BCPRINTER_PRINTER2_HOST = None +if options.has_option('bcprinter', 'printer2_host'): + BCPRINTER_PRINTER1_HOST = options.get('bcprinter', 'printer2_host') +BCPRINTER_PRINTER2_PORT=9100 +if options.has_option('bcprinter', 'printer2_port'): + BCPRINTER_PRINTER2_PORT = int(options.get('bcprinter', 'printer2_port'))