Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 227 lines (185 sloc) 7.507 kb
e3f86da django skeleton
James Socol authored
1 # Django settings for kitsune project.
e6f8ac3 Getting basic settings in place
James Socol authored
2 import os
3 import logging
e3f86da django skeleton
James Socol authored
4
6d1cb11 Updating to Tower 0.3 and fixing the failing tests.
James Socol authored
5 from tower import ugettext_lazy as _lazy
2a1a7ab @pcraciunoiu Adding context processor for site title
pcraciunoiu authored
6
d03b6f8 Adding middleware and tests. Removing dependency on django-localeurl.…
James Socol authored
7 import sumo_locales
8
e3f86da django skeleton
James Socol authored
9 DEBUG = True
10 TEMPLATE_DEBUG = DEBUG
e6f8ac3 Getting basic settings in place
James Socol authored
11 LOG_LEVEL = logging.DEBUG
12
13 ROOT = os.path.dirname(os.path.abspath(__file__))
14 path = lambda *a: os.path.join(ROOT, *a)
e3f86da django skeleton
James Socol authored
15
16 ADMINS = (
17 # ('Your Name', 'your_email@domain.com'),
18 )
19
20 MANAGERS = ADMINS
21
22 DATABASES = {
23 'default': {
e6f8ac3 Getting basic settings in place
James Socol authored
24 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
7f40103 @pcraciunoiu Revert changes to DATABASES formatting in settings.py
pcraciunoiu authored
25 'NAME': 'kitsune', # Or path to database file if using sqlite3.
26 'USER': '', # Not used with sqlite3.
27 'PASSWORD': '', # Not used with sqlite3.
28 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
29 'PORT': '', # Set to empty string for default. Not used with sqlite3.
6667c90 Fixing errors found by check.py
James Socol authored
30 'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
e3f86da django skeleton
James Socol authored
31 }
32 }
33
7fff588 Adding multidb support
James Socol authored
34 DATABASE_ROUTERS = ('multidb.MasterSlaveRouter',)
35
36 # Put the aliases for your slave databases in this list
37 SLAVE_DATABASES = []
38
09336ac Adding default caching info to settings.py
James Socol authored
39 # Cache Settings
40 #CACHE_BACKEND = 'caching.backends.memcached://localhost:11211'
41 #CACHE_PREFIX = 'sumo:'
42
43
e3f86da django skeleton
James Socol authored
44 # Local time zone for this installation. Choices can be found here:
45 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
46 # although not all choices may be available on all operating systems.
47 # If running in a Windows environment this must be set to the same as your
48 # system time zone.
e6f8ac3 Getting basic settings in place
James Socol authored
49 TIME_ZONE = 'America/Los_Angeles'
e3f86da django skeleton
James Socol authored
50
51 # Language code for this installation. All choices can be found here:
52 # http://www.i18nguy.com/unicode/language-identifiers.html
d03b6f8 Adding middleware and tests. Removing dependency on django-localeurl.…
James Socol authored
53 LANGUAGE_CODE = 'en-US'
54
55 # Supported languages
56 SUMO_LANGUAGES = (
57 'ar', 'as', 'bg', 'bn-BD', 'bn-IN', 'ca', 'cs', 'da', 'de', 'el', 'en-US',
58 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fr', 'fur', 'fy-NL', 'ga-IE', 'gl',
59 'gu-IN', 'he', 'hi-IN', 'hr', 'hu', 'id', 'is', 'it', 'ja', 'kk', 'kn',
60 'ko', 'lt', 'mk', 'mn', 'mr', 'ms', 'nb-NO', 'nl', 'no', 'oc', 'pa-IN',
61 'pl', 'pt-BR', 'pt-PT', 'rm', 'ro', 'ru', 'rw', 'si', 'sk', 'sl',
62 'sq', 'sr-CYRL', 'sr-LATN', 'sv-SE', 'ta-LK', 'te', 'th', 'tr',
63 'uk', 'vi', 'zh-CN', 'zh-TW',
64 )
65
66 LANGUAGES = dict([(i.lower(), sumo_locales.languages[i].native)
67 for i in SUMO_LANGUAGES])
68
69 LANGUAGE_URL_MAP = dict([(i.lower(), i) for i in SUMO_LANGUAGES])
70
71 TEXT_DOMAIN = 'k-messages'
e3f86da django skeleton
James Socol authored
72
73 SITE_ID = 1
2a1a7ab @pcraciunoiu Adding context processor for site title
pcraciunoiu authored
74 SITE_TITLE = _lazy(u'Firefox Support', 'site_title')
75
e3f86da django skeleton
James Socol authored
76
77 # If you set this to False, Django will make some optimizations so as not
78 # to load the internationalization machinery.
79 USE_I18N = True
d03b6f8 Adding middleware and tests. Removing dependency on django-localeurl.…
James Socol authored
80 USE_L10N = True
e3f86da django skeleton
James Socol authored
81
82 # Absolute path to the directory that holds media.
83 # Example: "/home/media/media.lawrence.com/"
e6f8ac3 Getting basic settings in place
James Socol authored
84 MEDIA_ROOT = path('media')
e3f86da django skeleton
James Socol authored
85
86 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
87 # trailing slash if there is a path component (optional in other cases).
88 # Examples: "http://media.lawrence.com", "http://example.com/media/"
e6f8ac3 Getting basic settings in place
James Socol authored
89 MEDIA_URL = '/media/'
e3f86da django skeleton
James Socol authored
90
91 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
92 # trailing slash.
93 # Examples: "http://foo.com/media/", "/media/".
e6f8ac3 Getting basic settings in place
James Socol authored
94 ADMIN_MEDIA_PREFIX = '/admin-media/'
e3f86da django skeleton
James Socol authored
95
d03b6f8 Adding middleware and tests. Removing dependency on django-localeurl.…
James Socol authored
96 # Paths that don't require a locale prefix.
97 SUPPORTED_NONLOCALES = ('media',)
98
e3f86da django skeleton
James Socol authored
99 # Make this unique, and don't share it with anybody.
100 SECRET_KEY = '#%tc(zja8j01!r#h_y)=hy!^k)9az74k+-ib&ij&+**s3-e^_z'
101
102 # List of callables that know how to import templates from various sources.
103 TEMPLATE_LOADERS = (
104 'django.template.loaders.filesystem.Loader',
105 'django.template.loaders.app_directories.Loader',
106 # 'django.template.loaders.eggs.Loader',
107 )
108
899dcd3 Adding request processor to settings.py
James Socol authored
109 TEMPLATE_CONTEXT_PROCESSORS = (
110 'django.core.context_processors.auth',
111 'django.core.context_processors.debug',
112 'django.core.context_processors.media',
113 'django.core.context_processors.request',
2a1a7ab @pcraciunoiu Adding context processor for site title
pcraciunoiu authored
114 'django.contrib.messages.context_processors.messages',
115 'sumo.context_processors.title',
899dcd3 Adding request processor to settings.py
James Socol authored
116 )
117
e3f86da django skeleton
James Socol authored
118 MIDDLEWARE_CLASSES = (
d03b6f8 Adding middleware and tests. Removing dependency on django-localeurl.…
James Socol authored
119 'sumo.middleware.LocaleURLMiddleware',
e3f86da django skeleton
James Socol authored
120 'django.middleware.common.CommonMiddleware',
121 'django.contrib.sessions.middleware.SessionMiddleware',
122 'django.middleware.csrf.CsrfViewMiddleware',
123 'django.contrib.auth.middleware.AuthenticationMiddleware',
124 'django.contrib.messages.middleware.MessageMiddleware',
125 )
126
127 ROOT_URLCONF = 'kitsune.urls'
128
129 TEMPLATE_DIRS = (
bbd7660 use settings for SEARCH_MAX_RESULTS
James Socol authored
130 # Put strings here, like "/home/html/django_templates"
e3f86da django skeleton
James Socol authored
131 # Always use forward slashes, even on Windows.
132 # Don't forget to use absolute paths, not relative paths.
e6f8ac3 Getting basic settings in place
James Socol authored
133 path('templates'),
e3f86da django skeleton
James Socol authored
134 )
135
136 INSTALLED_APPS = (
137 'django.contrib.auth',
138 'django.contrib.contenttypes',
139 'django.contrib.sessions',
140 'django.contrib.sites',
141 'django.contrib.messages',
c71ddce Adding translate-toolkit to requirements-dev.txt and settings in sett…
James Socol authored
142 'tower',
6eda039 Starting test suite
James Socol authored
143 'sumo',
144 'search',
e3f86da django skeleton
James Socol authored
145 )
1f39be2 adding sphinx configs to settings.py
James Socol authored
146
a927cfb Build scripts!
James Socol authored
147 # Extra apps for testing
148 if DEBUG:
149 INSTALLED_APPS += (
150 'django_extensions',
151 'django_nose',
152 'test_utils',
153 )
154
82d584e groundwork for running tests
James Socol authored
155 TEST_RUNNER = 'test_utils.runner.RadicalTestSuiteRunner'
156
c71ddce Adding translate-toolkit to requirements-dev.txt and settings in sett…
James Socol authored
157 def JINJA_CONFIG():
158 import jinja2
159 from django.conf import settings
160 from caching.base import cache
161 config = {'extensions': ['tower.template.i18n', 'caching.ext.cache',],
162 'finalize': lambda x: x if x is not None else ''}
163 if 'memcached' in cache.scheme and not settings.DEBUG:
164 # We're passing the _cache object directly to jinja because
165 # Django can't store binary directly; it enforces unicode on it.
166 # Details: http://jinja.pocoo.org/2/documentation/api#bytecode-cache
167 # and in the errors you get when you try it the other way.
168 bc = jinja2.MemcachedBytecodeCache(cache._cache,
169 "%sj2:" % settings.CACHE_PREFIX)
170 config['cache_size'] = -1 # Never clear the cache
171 config['bytecode_cache'] = bc
172 return config
173
174 # Tells the extract script what files to look for l10n in and what function
175 # handles the extraction. The Tower library expects this.
176 DOMAIN_METHODS = {
177 'messages': [
178 ('apps/**.py',
179 'tower.management.commands.extract.extract_tower_python'),
180 ('**/templates/**.html',
181 'tower.management.commands.extract.extract_tower_template'),
182 ],
183 'lhtml': [
184 ('**/templates/**.lhtml',
185 'tower.management.commands.extract.extract_tower_template'),
186 ],
187 'javascript': [
188 # We can't say **.js because that would dive into any libraries.
189 ('media/js/*.js', 'javascript'),
190 ],
191 }
192
193 # If you have trouble extracting strings with Tower, try setting this
194 # to True
195 TOWER_ADD_HEADERS=True
196
df61956 Getting the basics of what to test laid out
James Socol authored
197 # Directory storying myspell dictionaries (with trailing slash)
198 DICT_DIR = '/usr/share/myspell/'
c71ddce Adding translate-toolkit to requirements-dev.txt and settings in sett…
James Socol authored
199 # Path to a file with a list of custom words.
80dcaf8 Adding custom word lists and tests. Reversed logic on spellcheck() to…
James Socol authored
200 WORD_LIST = path('configs/words.txt')
df61956 Getting the basics of what to test laid out
James Socol authored
201
202 #
1f39be2 adding sphinx configs to settings.py
James Socol authored
203 # Connection information for Sphinx search
204 SPHINX_HOST = '127.0.0.1'
205 SPHINX_PORT = 3312
603141f new adding settings for search forum thread weight decay
James Socol authored
206
a927cfb Build scripts!
James Socol authored
207 SPHINX_INDEXER = '/usr/bin/indexer'
208 SPHINX_SEARCHD = '/usr/bin/searchd'
8e39688 Adding in the machinery to do sphinx tests
James Socol authored
209 SPHINX_CONFIG_PATH = path('configs/sphinx/sphinx.conf')
210
603141f new adding settings for search forum thread weight decay
James Socol authored
211 #
212 # Sphinx results tweaking
d72455a Rename a few settings from SPHINX_* to SEARCH_*
James Socol authored
213 SEARCH_FORUM_MIN_AGE = 7 # age before which decay doesn't apply, in days
214 SEARCH_FORUM_HALF_LIFE = 14 # controls the decay rate, in days
bbd7660 use settings for SEARCH_MAX_RESULTS
James Socol authored
215 SEARCH_MAX_RESULTS = 1000
d72455a Rename a few settings from SPHINX_* to SEARCH_*
James Socol authored
216 SEARCH_RESULTS_PER_PAGE = 10
217
6667c90 Fixing errors found by check.py
James Socol authored
218 #
d72455a Rename a few settings from SPHINX_* to SEARCH_*
James Socol authored
219 # Search default settings
35ebd8b @pcraciunoiu Fix up all filters except sorting, and all check.py complaints for af…
pcraciunoiu authored
220 # comma-separated tuple of category IDs
73c5ab4 Turns negative categories into exclusions.
James Socol authored
221 SEARCH_DEFAULT_CATEGORIES = (1, 17, 18, -3,)
35ebd8b @pcraciunoiu Fix up all filters except sorting, and all check.py complaints for af…
pcraciunoiu authored
222 SEARCH_DEFAULT_FORUMS = (1,) # default forum ID (eg: 1 on sumo, 5 on mosumo)
33fbc03 @pcraciunoiu move __init__ to common SearchClient and define constant for multiplier
pcraciunoiu authored
223 SEARCH_SUMMARY_LENGTH = 275
224 # because of markup cleanup, search summaries lengths vary quite a bit
225 # so we extract longer excerpts and perform truncation to the length above
226 SEARCH_SUMMARY_LENGTH_MULTIPLIER = 1.3
Something went wrong with that request. Please try again.