mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 1 | # Django settings for frontend project. |
| 2 | |
showard | e90eb5e | 2008-07-25 20:54:21 +0000 | [diff] [blame] | 3 | import os |
mbligh | 437c3a6 | 2008-04-07 00:42:57 +0000 | [diff] [blame] | 4 | import common |
| 5 | from autotest_lib.client.common_lib import global_config |
showard | fa7ef63 | 2008-03-26 00:02:30 +0000 | [diff] [blame] | 6 | |
Dale Curtis | 74a314b | 2011-06-23 14:55:46 -0700 | [diff] [blame] | 7 | c = global_config.global_config |
| 8 | _section = 'AUTOTEST_WEB' |
| 9 | |
| 10 | DEBUG = c.get_config_value(_section, "sql_debug_mode", type=bool, default=False) |
| 11 | TEMPLATE_DEBUG = c.get_config_value(_section, "template_debug_mode", type=bool, |
| 12 | default=False) |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 13 | |
| 14 | FULL_ADMIN = False |
| 15 | |
| 16 | ADMINS = ( |
| 17 | # ('Your Name', 'your_email@domain.com'), |
| 18 | ) |
| 19 | |
| 20 | MANAGERS = ADMINS |
| 21 | |
Mike Truty | 3536b98 | 2011-08-29 13:05:16 -0700 | [diff] [blame] | 22 | def _get_config(config_key, default=None): |
Dale Curtis | 8adf789 | 2011-09-08 16:13:36 -0700 | [diff] [blame] | 23 | return c.get_config_value(_section, config_key, default=default) |
showard | fa7ef63 | 2008-03-26 00:02:30 +0000 | [diff] [blame] | 24 | |
Mike Truty | 3536b98 | 2011-08-29 13:05:16 -0700 | [diff] [blame] | 25 | AUTOTEST_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"))} |
showard | 09096d8 | 2008-07-07 23:20:49 +0000 | [diff] [blame] | 34 | |
Mike Truty | 3536b98 | 2011-08-29 13:05:16 -0700 | [diff] [blame] | 35 | if AUTOTEST_DEFAULT['READONLY_USER'] != AUTOTEST_DEFAULT['USER']: |
| 36 | AUTOTEST_DEFAULT['READONLY_PASSWORD'] = _get_config("readonly_password", |
| 37 | default='') |
showard | 7a37db1 | 2009-01-08 23:31:08 +0000 | [diff] [blame] | 38 | else: |
Mike Truty | 3536b98 | 2011-08-29 13:05:16 -0700 | [diff] [blame] | 39 | AUTOTEST_DEFAULT['READONLY_PASSWORD'] = AUTOTEST_DEFAULT['PASSWORD'] |
| 40 | |
| 41 | DATABASES = {'default': AUTOTEST_DEFAULT} |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 42 | |
| 43 | # prefix applied to all URLs - useful if requests are coming through apache, |
| 44 | # and you need this app to coexist with others |
| 45 | URL_PREFIX = 'afe/server/' |
showard | 250d84d | 2010-01-12 21:59:48 +0000 | [diff] [blame] | 46 | TKO_URL_PREFIX = 'new_tko/server/' |
Mike Truty | ddd44b2 | 2011-04-14 15:38:56 -0700 | [diff] [blame] | 47 | CROSCHART_URL_PREFIX = 'croschart/server/' |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 48 | |
| 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. |
| 54 | TIME_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 |
| 59 | LANGUAGE_CODE = 'en-us' |
| 60 | |
| 61 | SITE_ID = 1 |
| 62 | |
| 63 | # If you set this to False, Django will make some optimizations so as not |
| 64 | # to load the internationalization machinery. |
| 65 | USE_I18N = True |
| 66 | |
| 67 | # Absolute path to the directory that holds media. |
| 68 | # Example: "/home/media/media.lawrence.com/" |
| 69 | MEDIA_ROOT = '' |
| 70 | |
| 71 | # URL that handles the media served from MEDIA_ROOT. |
| 72 | # Example: "http://media.lawrence.com" |
| 73 | MEDIA_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/". |
| 78 | ADMIN_MEDIA_PREFIX = '/media/' |
| 79 | |
| 80 | # Make this unique, and don't share it with anybody. |
| 81 | SECRET_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. |
| 84 | TEMPLATE_LOADERS = ( |
Mike Truty | f5814ba | 2011-08-29 18:27:46 -0700 | [diff] [blame] | 85 | 'django.template.loaders.filesystem.Loader', |
| 86 | 'django.template.loaders.app_directories.Loader', |
| 87 | # 'django.template.loaders.eggs.Loader', |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 88 | ) |
| 89 | |
| 90 | MIDDLEWARE_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', |
showard | 00b167c | 2010-02-03 20:29:45 +0000 | [diff] [blame] | 96 | 'frontend.shared.json_html_formatter.JsonToHtmlMiddleware', |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 97 | ) |
| 98 | |
| 99 | ROOT_URLCONF = 'frontend.urls' |
| 100 | |
| 101 | TEMPLATE_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. |
showard | 37c7fe6 | 2008-07-24 16:35:02 +0000 | [diff] [blame] | 105 | |
Mike Truty | ddd44b2 | 2011-04-14 15:38:56 -0700 | [diff] [blame] | 106 | os.path.abspath(os.path.dirname(__file__) + '/templates'), |
| 107 | os.path.abspath(os.path.dirname(__file__) + '/croschart/templates') |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 108 | ) |
| 109 | |
| 110 | INSTALLED_APPS = ( |
| 111 | 'frontend.afe', |
showard | 250d84d | 2010-01-12 21:59:48 +0000 | [diff] [blame] | 112 | 'frontend.tko', |
Mike Truty | ddd44b2 | 2011-04-14 15:38:56 -0700 | [diff] [blame] | 113 | 'frontend.croschart', |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 114 | 'django.contrib.admin', |
| 115 | 'django.contrib.auth', |
| 116 | 'django.contrib.contenttypes', |
| 117 | 'django.contrib.sessions', |
| 118 | 'django.contrib.sites', |
| 119 | ) |
| 120 | |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 121 | AUTHENTICATION_BACKENDS = ( |
| 122 | 'frontend.apache_auth.SimpleAuthBackend', |
| 123 | ) |
Scott Zawalski | 38428ef | 2012-07-10 15:29:10 -0400 | [diff] [blame] | 124 | # TODO(scottz): Temporary addition until time can be spent untangling middleware |
| 125 | # session crosbug.com/31608 |
| 126 | SESSION_COOKIE_AGE = 1200 |