blob: 6660843e6b8f29a15113458cb490148cf13e361c [file] [log] [blame]
mblighe8819cd2008-02-15 16:48:40 +00001# Django settings for frontend project.
2
showarde90eb5e2008-07-25 20:54:21 +00003import os
mbligh437c3a62008-04-07 00:42:57 +00004import common
5from autotest_lib.client.common_lib import global_config
showardfa7ef632008-03-26 00:02:30 +00006
Dale Curtis74a314b2011-06-23 14:55:46 -07007c = global_config.global_config
8_section = 'AUTOTEST_WEB'
9
10DEBUG = c.get_config_value(_section, "sql_debug_mode", type=bool, default=False)
11TEMPLATE_DEBUG = c.get_config_value(_section, "template_debug_mode", type=bool,
12 default=False)
mblighe8819cd2008-02-15 16:48:40 +000013
14FULL_ADMIN = False
15
16ADMINS = (
17 # ('Your Name', 'your_email@domain.com'),
18)
19
20MANAGERS = ADMINS
21
Mike Truty3536b982011-08-29 13:05:16 -070022def _get_config(config_key, default=None):
Dale Curtis8adf7892011-09-08 16:13:36 -070023 return c.get_config_value(_section, config_key, default=default)
showardfa7ef632008-03-26 00:02:30 +000024
Mike Truty3536b982011-08-29 13:05:16 -070025AUTOTEST_DEFAULT = {
26 'ENGINE': 'autotest_lib.frontend.db.backends.afe',
27 'PORT': '',
28 'HOST': _get_config("host"),
29 'NAME': _get_config("database"),
30 'USER': _get_config("user"),
31 'PASSWORD': _get_config("password", default=''),
32 'READONLY_HOST': _get_config("readonly_host", default=_get_config("host")),
33 'READONLY_USER': _get_config("readonly_user", default=_get_config("user"))}
showard09096d82008-07-07 23:20:49 +000034
Mike Truty3536b982011-08-29 13:05:16 -070035if AUTOTEST_DEFAULT['READONLY_USER'] != AUTOTEST_DEFAULT['USER']:
36 AUTOTEST_DEFAULT['READONLY_PASSWORD'] = _get_config("readonly_password",
37 default='')
showard7a37db12009-01-08 23:31:08 +000038else:
Mike Truty3536b982011-08-29 13:05:16 -070039 AUTOTEST_DEFAULT['READONLY_PASSWORD'] = AUTOTEST_DEFAULT['PASSWORD']
40
41DATABASES = {'default': AUTOTEST_DEFAULT}
mblighe8819cd2008-02-15 16:48:40 +000042
43# prefix applied to all URLs - useful if requests are coming through apache,
44# and you need this app to coexist with others
45URL_PREFIX = 'afe/server/'
showard250d84d2010-01-12 21:59:48 +000046TKO_URL_PREFIX = 'new_tko/server/'
Mike Trutyddd44b22011-04-14 15:38:56 -070047CROSCHART_URL_PREFIX = 'croschart/server/'
mblighe8819cd2008-02-15 16:48:40 +000048
49# Local time zone for this installation. Choices can be found here:
50# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
51# although not all variations may be possible on all operating systems.
52# If running in a Windows environment this must be set to the same as your
53# system time zone.
54TIME_ZONE = 'America/Los_Angeles'
55
56# Language code for this installation. All choices can be found here:
57# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
58# http://blogs.law.harvard.edu/tech/stories/storyReader$15
59LANGUAGE_CODE = 'en-us'
60
61SITE_ID = 1
62
63# If you set this to False, Django will make some optimizations so as not
64# to load the internationalization machinery.
65USE_I18N = True
66
67# Absolute path to the directory that holds media.
68# Example: "/home/media/media.lawrence.com/"
69MEDIA_ROOT = ''
70
71# URL that handles the media served from MEDIA_ROOT.
72# Example: "http://media.lawrence.com"
73MEDIA_URL = ''
74
75# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
76# trailing slash.
77# Examples: "http://foo.com/media/", "/media/".
78ADMIN_MEDIA_PREFIX = '/media/'
79
80# Make this unique, and don't share it with anybody.
81SECRET_KEY = 'pn-t15u(epetamdflb%dqaaxw+5u&2#0u-jah70w1l*_9*)=n7'
82
83# List of callables that know how to import templates from various sources.
84TEMPLATE_LOADERS = (
Mike Trutyf5814ba2011-08-29 18:27:46 -070085 'django.template.loaders.filesystem.Loader',
86 'django.template.loaders.app_directories.Loader',
87# 'django.template.loaders.eggs.Loader',
mblighe8819cd2008-02-15 16:48:40 +000088)
89
90MIDDLEWARE_CLASSES = (
91 'django.middleware.common.CommonMiddleware',
92 'django.contrib.sessions.middleware.SessionMiddleware',
93 'frontend.apache_auth.ApacheAuthMiddleware',
94 'django.contrib.auth.middleware.AuthenticationMiddleware',
95 'django.middleware.doc.XViewMiddleware',
showard00b167c2010-02-03 20:29:45 +000096 'frontend.shared.json_html_formatter.JsonToHtmlMiddleware',
mblighe8819cd2008-02-15 16:48:40 +000097)
98
99ROOT_URLCONF = 'frontend.urls'
100
101TEMPLATE_DIRS = (
102 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
103 # Always use forward slashes, even on Windows.
104 # Don't forget to use absolute paths, not relative paths.
showard37c7fe62008-07-24 16:35:02 +0000105
Mike Trutyddd44b22011-04-14 15:38:56 -0700106 os.path.abspath(os.path.dirname(__file__) + '/templates'),
107 os.path.abspath(os.path.dirname(__file__) + '/croschart/templates')
mblighe8819cd2008-02-15 16:48:40 +0000108)
109
110INSTALLED_APPS = (
111 'frontend.afe',
showard250d84d2010-01-12 21:59:48 +0000112 'frontend.tko',
Mike Trutyddd44b22011-04-14 15:38:56 -0700113 'frontend.croschart',
mblighe8819cd2008-02-15 16:48:40 +0000114 'django.contrib.admin',
115 'django.contrib.auth',
116 'django.contrib.contenttypes',
117 'django.contrib.sessions',
118 'django.contrib.sites',
119)
120
mblighe8819cd2008-02-15 16:48:40 +0000121AUTHENTICATION_BACKENDS = (
122 'frontend.apache_auth.SimpleAuthBackend',
123)
Scott Zawalski38428ef2012-07-10 15:29:10 -0400124# TODO(scottz): Temporary addition until time can be spent untangling middleware
125# session crosbug.com/31608
126SESSION_COOKIE_AGE = 1200