Dennis Jeffrey | b95ba5a | 2012-11-12 17:55:18 -0800 | [diff] [blame] | 1 | """Django settings for frontend project. |
| 2 | """ |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 3 | |
showard | e90eb5e | 2008-07-25 20:54:21 +0000 | [diff] [blame] | 4 | import os |
mbligh | 437c3a6 | 2008-04-07 00:42:57 +0000 | [diff] [blame] | 5 | import common |
| 6 | from autotest_lib.client.common_lib import global_config |
Jakob Juelich | 934f0dc | 2014-10-14 18:21:13 -0700 | [diff] [blame^] | 7 | from autotest_lib.frontend import database_settings_helper |
showard | fa7ef63 | 2008-03-26 00:02:30 +0000 | [diff] [blame] | 8 | |
Dale Curtis | 74a314b | 2011-06-23 14:55:46 -0700 | [diff] [blame] | 9 | c = global_config.global_config |
| 10 | _section = 'AUTOTEST_WEB' |
| 11 | |
| 12 | DEBUG = c.get_config_value(_section, "sql_debug_mode", type=bool, default=False) |
| 13 | TEMPLATE_DEBUG = c.get_config_value(_section, "template_debug_mode", type=bool, |
| 14 | default=False) |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 15 | |
| 16 | FULL_ADMIN = False |
| 17 | |
| 18 | ADMINS = ( |
| 19 | # ('Your Name', 'your_email@domain.com'), |
| 20 | ) |
| 21 | |
| 22 | MANAGERS = ADMINS |
| 23 | |
Jakob Juelich | 934f0dc | 2014-10-14 18:21:13 -0700 | [diff] [blame^] | 24 | AUTOTEST_DEFAULT = database_settings_helper.get_default_db_config() |
Alex Miller | 47d6128 | 2013-04-17 13:53:58 -0700 | [diff] [blame] | 25 | |
| 26 | ALLOWED_HOSTS = '*' |
showard | 09096d8 | 2008-07-07 23:20:49 +0000 | [diff] [blame] | 27 | |
Jakob Juelich | 934f0dc | 2014-10-14 18:21:13 -0700 | [diff] [blame^] | 28 | DATABASES = {'default': AUTOTEST_DEFAULT,} |
Mike Truty | 3536b98 | 2011-08-29 13:05:16 -0700 | [diff] [blame] | 29 | |
Jakob Juelich | 934f0dc | 2014-10-14 18:21:13 -0700 | [diff] [blame^] | 30 | # 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. |
| 34 | SECRET_KEY = 'pn-t15u(epetamdflb%dqaaxw+5u&2#0u-jah70w1l*_9*)=n7' |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 35 | |
| 36 | # prefix applied to all URLs - useful if requests are coming through apache, |
| 37 | # and you need this app to coexist with others |
| 38 | URL_PREFIX = 'afe/server/' |
showard | 250d84d | 2010-01-12 21:59:48 +0000 | [diff] [blame] | 39 | TKO_URL_PREFIX = 'new_tko/server/' |
Mike Truty | ddd44b2 | 2011-04-14 15:38:56 -0700 | [diff] [blame] | 40 | CROSCHART_URL_PREFIX = 'croschart/server/' |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 41 | |
| 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. |
| 47 | TIME_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 |
| 52 | LANGUAGE_CODE = 'en-us' |
| 53 | |
| 54 | SITE_ID = 1 |
| 55 | |
| 56 | # If you set this to False, Django will make some optimizations so as not |
| 57 | # to load the internationalization machinery. |
| 58 | USE_I18N = True |
| 59 | |
| 60 | # Absolute path to the directory that holds media. |
| 61 | # Example: "/home/media/media.lawrence.com/" |
| 62 | MEDIA_ROOT = '' |
| 63 | |
| 64 | # URL that handles the media served from MEDIA_ROOT. |
| 65 | # Example: "http://media.lawrence.com" |
| 66 | MEDIA_URL = '' |
| 67 | |
Jiaxi Luo | c342f9f | 2014-05-19 16:22:03 -0700 | [diff] [blame] | 68 | # URL prefix of static file. Only used by the admin interface. |
| 69 | STATIC_URL = '/' + URL_PREFIX + 'admin/' |
| 70 | |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 71 | # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a |
| 72 | # trailing slash. |
| 73 | # Examples: "http://foo.com/media/", "/media/". |
| 74 | ADMIN_MEDIA_PREFIX = '/media/' |
| 75 | |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 76 | # List of callables that know how to import templates from various sources. |
| 77 | TEMPLATE_LOADERS = ( |
Mike Truty | f5814ba | 2011-08-29 18:27:46 -0700 | [diff] [blame] | 78 | 'django.template.loaders.filesystem.Loader', |
| 79 | 'django.template.loaders.app_directories.Loader', |
| 80 | # 'django.template.loaders.eggs.Loader', |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 81 | ) |
| 82 | |
| 83 | MIDDLEWARE_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 Luo | 76a11d3 | 2014-05-08 19:03:28 -0700 | [diff] [blame] | 89 | 'django.contrib.messages.middleware.MessageMiddleware', |
showard | 00b167c | 2010-02-03 20:29:45 +0000 | [diff] [blame] | 90 | 'frontend.shared.json_html_formatter.JsonToHtmlMiddleware', |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 91 | ) |
| 92 | |
| 93 | ROOT_URLCONF = 'frontend.urls' |
| 94 | |
| 95 | TEMPLATE_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. |
showard | 37c7fe6 | 2008-07-24 16:35:02 +0000 | [diff] [blame] | 99 | |
Mike Truty | ddd44b2 | 2011-04-14 15:38:56 -0700 | [diff] [blame] | 100 | os.path.abspath(os.path.dirname(__file__) + '/templates'), |
Dennis Jeffrey | b95ba5a | 2012-11-12 17:55:18 -0800 | [diff] [blame] | 101 | os.path.abspath(os.path.dirname(__file__) + '/croschart/templates'), |
| 102 | os.path.abspath(os.path.dirname(__file__) + '/perf-dashboard/templates') |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 103 | ) |
| 104 | |
| 105 | INSTALLED_APPS = ( |
| 106 | 'frontend.afe', |
showard | 250d84d | 2010-01-12 21:59:48 +0000 | [diff] [blame] | 107 | 'frontend.tko', |
Mike Truty | ddd44b2 | 2011-04-14 15:38:56 -0700 | [diff] [blame] | 108 | 'frontend.croschart', |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 109 | 'django.contrib.admin', |
| 110 | 'django.contrib.auth', |
| 111 | 'django.contrib.contenttypes', |
| 112 | 'django.contrib.sessions', |
| 113 | 'django.contrib.sites', |
| 114 | ) |
| 115 | |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 116 | AUTHENTICATION_BACKENDS = ( |
| 117 | 'frontend.apache_auth.SimpleAuthBackend', |
| 118 | ) |
Scott Zawalski | 38428ef | 2012-07-10 15:29:10 -0400 | [diff] [blame] | 119 | # TODO(scottz): Temporary addition until time can be spent untangling middleware |
| 120 | # session crosbug.com/31608 |
| 121 | SESSION_COOKIE_AGE = 1200 |
Aviv Keshet | 62cf047 | 2013-05-04 22:40:17 -0700 | [diff] [blame] | 122 | |
| 123 | AUTOTEST_CREATE_ADMIN_GROUPS = True |