blob: 0e8f5028d0034bc8d08a53060e8dbbc1249078a3 [file] [log] [blame]
Dennis Jeffreyb95ba5a2012-11-12 17:55:18 -08001"""Django settings for frontend project.
2"""
mblighe8819cd2008-02-15 16:48:40 +00003
showarde90eb5e2008-07-25 20:54:21 +00004import os
mbligh437c3a62008-04-07 00:42:57 +00005import common
6from autotest_lib.client.common_lib import global_config
Jakob Juelich934f0dc2014-10-14 18:21:13 -07007from autotest_lib.frontend import database_settings_helper
showardfa7ef632008-03-26 00:02:30 +00008
Dale Curtis74a314b2011-06-23 14:55:46 -07009c = global_config.global_config
10_section = 'AUTOTEST_WEB'
11
12DEBUG = c.get_config_value(_section, "sql_debug_mode", type=bool, default=False)
13TEMPLATE_DEBUG = c.get_config_value(_section, "template_debug_mode", type=bool,
14 default=False)
mblighe8819cd2008-02-15 16:48:40 +000015
16FULL_ADMIN = False
17
18ADMINS = (
19 # ('Your Name', 'your_email@domain.com'),
20)
21
22MANAGERS = ADMINS
23
Jakob Juelich934f0dc2014-10-14 18:21:13 -070024AUTOTEST_DEFAULT = database_settings_helper.get_default_db_config()
Alex Miller47d61282013-04-17 13:53:58 -070025
26ALLOWED_HOSTS = '*'
showard09096d82008-07-07 23:20:49 +000027
Jakob Juelich934f0dc2014-10-14 18:21:13 -070028DATABASES = {'default': AUTOTEST_DEFAULT,}
Mike Truty3536b982011-08-29 13:05:16 -070029
Jakob Juelich934f0dc2014-10-14 18:21:13 -070030# Have to set SECRET_KEY before importing connections because of this bug:
31# https://code.djangoproject.com/ticket/20704
32# TODO: Order this again after an upgrade to Django 1.6 or higher.
33# Make this unique, and don't share it with anybody.
34SECRET_KEY = 'pn-t15u(epetamdflb%dqaaxw+5u&2#0u-jah70w1l*_9*)=n7'
mblighe8819cd2008-02-15 16:48:40 +000035
36# prefix applied to all URLs - useful if requests are coming through apache,
37# and you need this app to coexist with others
38URL_PREFIX = 'afe/server/'
showard250d84d2010-01-12 21:59:48 +000039TKO_URL_PREFIX = 'new_tko/server/'
Mike Trutyddd44b22011-04-14 15:38:56 -070040CROSCHART_URL_PREFIX = 'croschart/server/'
mblighe8819cd2008-02-15 16:48:40 +000041
42# Local time zone for this installation. Choices can be found here:
43# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
44# although not all variations may be possible on all operating systems.
45# If running in a Windows environment this must be set to the same as your
46# system time zone.
47TIME_ZONE = 'America/Los_Angeles'
48
49# Language code for this installation. All choices can be found here:
50# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
51# http://blogs.law.harvard.edu/tech/stories/storyReader$15
52LANGUAGE_CODE = 'en-us'
53
54SITE_ID = 1
55
56# If you set this to False, Django will make some optimizations so as not
57# to load the internationalization machinery.
58USE_I18N = True
59
60# Absolute path to the directory that holds media.
61# Example: "/home/media/media.lawrence.com/"
62MEDIA_ROOT = ''
63
64# URL that handles the media served from MEDIA_ROOT.
65# Example: "http://media.lawrence.com"
66MEDIA_URL = ''
67
Jiaxi Luoc342f9f2014-05-19 16:22:03 -070068# URL prefix of static file. Only used by the admin interface.
69STATIC_URL = '/' + URL_PREFIX + 'admin/'
70
mblighe8819cd2008-02-15 16:48:40 +000071# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
72# trailing slash.
73# Examples: "http://foo.com/media/", "/media/".
74ADMIN_MEDIA_PREFIX = '/media/'
75
mblighe8819cd2008-02-15 16:48:40 +000076# List of callables that know how to import templates from various sources.
77TEMPLATE_LOADERS = (
Mike Trutyf5814ba2011-08-29 18:27:46 -070078 'django.template.loaders.filesystem.Loader',
79 'django.template.loaders.app_directories.Loader',
80# 'django.template.loaders.eggs.Loader',
mblighe8819cd2008-02-15 16:48:40 +000081)
82
83MIDDLEWARE_CLASSES = (
84 'django.middleware.common.CommonMiddleware',
85 'django.contrib.sessions.middleware.SessionMiddleware',
86 'frontend.apache_auth.ApacheAuthMiddleware',
87 'django.contrib.auth.middleware.AuthenticationMiddleware',
88 'django.middleware.doc.XViewMiddleware',
Jiaxi Luo76a11d32014-05-08 19:03:28 -070089 'django.contrib.messages.middleware.MessageMiddleware',
showard00b167c2010-02-03 20:29:45 +000090 'frontend.shared.json_html_formatter.JsonToHtmlMiddleware',
mblighe8819cd2008-02-15 16:48:40 +000091)
92
93ROOT_URLCONF = 'frontend.urls'
94
95TEMPLATE_DIRS = (
96 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
97 # Always use forward slashes, even on Windows.
98 # Don't forget to use absolute paths, not relative paths.
showard37c7fe62008-07-24 16:35:02 +000099
Mike Trutyddd44b22011-04-14 15:38:56 -0700100 os.path.abspath(os.path.dirname(__file__) + '/templates'),
Dennis Jeffreyb95ba5a2012-11-12 17:55:18 -0800101 os.path.abspath(os.path.dirname(__file__) + '/croschart/templates'),
102 os.path.abspath(os.path.dirname(__file__) + '/perf-dashboard/templates')
mblighe8819cd2008-02-15 16:48:40 +0000103)
104
105INSTALLED_APPS = (
106 'frontend.afe',
showard250d84d2010-01-12 21:59:48 +0000107 'frontend.tko',
Mike Trutyddd44b22011-04-14 15:38:56 -0700108 'frontend.croschart',
mblighe8819cd2008-02-15 16:48:40 +0000109 'django.contrib.admin',
110 'django.contrib.auth',
111 'django.contrib.contenttypes',
112 'django.contrib.sessions',
113 'django.contrib.sites',
114)
115
mblighe8819cd2008-02-15 16:48:40 +0000116AUTHENTICATION_BACKENDS = (
117 'frontend.apache_auth.SimpleAuthBackend',
118)
Scott Zawalski38428ef2012-07-10 15:29:10 -0400119# TODO(scottz): Temporary addition until time can be spent untangling middleware
120# session crosbug.com/31608
121SESSION_COOKIE_AGE = 1200
Aviv Keshet62cf0472013-05-04 22:40:17 -0700122
123AUTOTEST_CREATE_ADMIN_GROUPS = True