FORCE_SCRIPT_NAME = env.get("force_script_name", "") or SCRIPT_NAME or None WEBAPP_ROOT = os.environ.get("WEBAPP_ROOT", os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) CCG_WRITABLE_DIRECTORY = env.get("writable_directory", os.path.join(WEBAPP_ROOT, "scratch")) PRODUCTION = env.get("production", False) SECURE_SSL_REDIRECT = env.get("ssl_redirect", PRODUCTION) # set debug, see: https://docs.djangoproject.com/en/dev/ref/settings/#debug DEBUG = env.get("debug", not PRODUCTION) APP_INSTANCE = env.get("app_instance", "turtle") DATABASES = { 'default': { 'ENGINE': env.get_db_engine("dbtype", "pgsql"), 'NAME': env.get("dbname", APP_INSTANCE), 'USER': env.get("dbuser", APP_INSTANCE), 'PASSWORD': env.get("dbpass", APP_INSTANCE), 'HOST': env.get("dbserver", ""), 'PORT': env.get("dbport", ""), } } # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts ALLOWED_HOSTS = env.getlist("allowed_hosts", ["localhost"]) # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems.
env = EnvConfig() CCG_INSTALL_ROOT = os.path.dirname(os.path.realpath(__file__)) CCG_WRITEABLE_DIRECTORY = os.path.join(CCG_INSTALL_ROOT,"scratch") PROJECT_NAME = os.path.basename(CCG_INSTALL_ROOT) # see ccg_django_utils.webhelpers BASE_URL_PATH = os.environ.get("SCRIPT_NAME", "") # See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production ALLOWED_HOSTS = env.getlist("allowed_hosts", ["*"]) DATABASES = { 'default': { 'ENGINE': env.get_db_engine("dbtype", "pgsql"), 'NAME': env.get("dbname", "mastrms"), 'USER': env.get("dbuser", "mastrms"), 'PASSWORD': env.get("dbpass", "mastrms"), 'HOST': env.get("dbserver", ""), 'PORT': env.get("dbport", ""), } } # see: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes MIDDLEWARE_CLASSES = [ 'userlog.middleware.RequestToThreadLocalMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
("de", "German"), ("fr", "French"), ("it", "Italian")) # EnvConfig can't handle structure of tuple of tuples so we pass in a flat association list # E.g. ["en","English","ar","Arabic"] # This must be a subset of ALL_LANGUAGES LANGUAGES_ASSOC_LIST = env.getlist("languages", ["en", "English"]) LANGUAGES = tuple(zip(LANGUAGES_ASSOC_LIST[0::2], LANGUAGES_ASSOC_LIST[1::2])) DATABASES = { 'default': { # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': env.get_db_engine("dbtype", "pgsql"), # Or path to database file if using sqlite3. 'NAME': env.get("dbname", "rdrf"), 'USER': env.get("dbuser", "rdrf"), # Not used with sqlite3. 'PASSWORD': env.get("dbpass", "rdrf"), # Not used with sqlite3. # Set to empty string for localhost. Not used with sqlite3. 'HOST': env.get("dbserver", ""), # Set to empty string for default. Not used with sqlite3. 'PORT': env.get("dbport", ""), } } # Clinical database (defaults to main db if not specified). DATABASES["clinical"] = { "ENGINE": env.get_db_engine("clinical_dbtype", "pgsql"), "NAME": env.get("clinical_dbname", DATABASES["default"]["NAME"]),
'django.contrib.messages.context_processors.messages', ], }, }, ] #WSGI_APPLICATION = 'sqlexplorer.wsgi.application' # Database # https://docs.djangoproject.com/en/1.10/ref/settings/#databases DATABASES = { # default database for auth, storing queries etc 'default': { # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': env.get_db_engine("dbtype", "sqlite3"), # Or path to database file if using sqlite3. 'NAME': env.get("dbname", os.path.join(BASE_DIR, 'db.sqlite3')), 'USER': env.get("dbuser", "webapp"), # Not used with sqlite3. 'PASSWORD': env.get("dbpass", "webapp"), # Not used with sqlite3. # Set to empty string for localhost. Not used with sqlite3. 'HOST': env.get("dbserver", ""), # Set to empty string for default. Not used with sqlite3. 'PORT': env.get("dbport", ""), } } # explorer database is the database we want to search with explorer DATABASES['explorer'] = { 'ENGINE': env.get_db_engine("explorer_dbtype", env.get("dbtype", "sqlite3")),