Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 184 lines (156 sloc) 5.323 kB
101aa12 initial import
Justine Tunney authored
1 r"""
2
3 occupywallst.settings
4 ~~~~~~~~~~~~~~~~~~~~~
5
6 This file is used to configure Django.
7
8 """
9
d2a5caa javascript minification
Justine Tunney authored
10 import os
11 import sys
12 from os.path import abspath, dirname, join, exists
101aa12 initial import
Justine Tunney authored
13 project_root = dirname(abspath(__file__))
14
d2a5caa javascript minification
Justine Tunney authored
15 MEDIA_ROOT = join(project_root, 'media')
16 GEOIP_PATH = join(project_root, 'data')
17 SHP_PATH = join(project_root, 'data')
18
101aa12 initial import
Justine Tunney authored
19 DEBUG = False
20 PAYPAL_DEBUG = DEBUG
21 AUTHNET_DEBUG = DEBUG
22 TEMPLATE_DEBUG = DEBUG
23
d998883 better white labeling, faster/simpler verbiage system
Justine Tunney authored
24 # please change these values in occupywallst/settings_local.py
25 OWS_SITE_NAME = 'OccupyWallSt.org'
26 OWS_CANONICAL_URL = 'http://occupywallst.org' # no path or trailing slash
9a2651f make settings.py easier to override
Justine Tunney authored
27 SECRET_KEY = 'please change me to some wacky random value'
28 RECAPTCHA_PUBLIC_KEY = 'please change me'
29 RECAPTCHA_PRIVATE_KEY = 'please change me'
30 SESSION_COOKIE_DOMAIN = '.occupywallst.org'
31 CSRF_COOKIE_DOMAIN = '.occupywallst.org'
32
03c6e61 forum improvements to deal with spam and valume
Justine Tunney authored
33 OWS_POST_LIMIT_THREAD = 60 * 10 # ten minutes
34 OWS_POST_LIMIT_COMMENT = 60 * 3 # three minutes
2d977a8 @thirtyseven implement comment depth limit
thirtyseven authored
35 OWS_MAX_COMMENT_DEPTH = 15
4936e38 stop private message spamming
Justine Tunney authored
36 OWS_MAX_PRIVMSG_USER_DAY = 7
85c1b07 notification system
Justine Tunney authored
37 OWS_NOTIFY_PUB_ADDR = ('127.0.0.1', 9010)
38
d2a5caa javascript minification
Justine Tunney authored
39 OWS_SCRIPTS = ['js/occupywallst/' + fname
40 for fname in os.listdir(join(MEDIA_ROOT, 'js/occupywallst'))]
41 OWS_SCRIPTS_MINIFIED = 'js/occupywallst.min.js'
101aa12 initial import
Justine Tunney authored
42
43 ADMINS = (
0660ae2 Revert "emergency read only mode"
Justine Tunney authored
44 ('', 'errors@occupywallst.org'),
101aa12 initial import
Justine Tunney authored
45 )
e99627a send error emails from right address
Justine Tunney authored
46
47 SERVER_EMAIL = 'webmaster@occupywallst.org'
a8bc6de simplify signup system and allow users to edit profile
Justine Tunney authored
48 DEFAULT_FROM_EMAIL = 'webmaster@occupywallst.org'
101aa12 initial import
Justine Tunney authored
49
50 MANAGERS = ADMINS
51
52 DATABASES = {
53 'default': {
c6eabe3 hooray!! hierarchical comments
Justine Tunney authored
54 'ENGINE': 'django.contrib.gis.db.backends.postgis',
55 'NAME': 'occupywallst',
56 },
101aa12 initial import
Justine Tunney authored
57 }
58
ec81210 trying to make this goofy chat thing
Justine Tunney authored
59 # store cache entries as json so node.js can read them. also we don't
60 # need no goofy key prefixes
f1aad16 set up caching, fixed api wrapper to email errors and commit/rollback
Justine Tunney authored
61 CACHES = {
62 'default': {
7c1a56a let's try fragment caching instead
Justine Tunney authored
63 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
d83466e no cache conflict between clone sites by virtual env
Justine Tunney authored
64 'KEY_PREFIX': os.getenv('VIRTUAL_ENV'),
f1aad16 set up caching, fixed api wrapper to email errors and commit/rollback
Justine Tunney authored
65 'LOCATION': [
66 '127.0.0.1:11211',
ec81210 trying to make this goofy chat thing
Justine Tunney authored
67 ],
0a12dcc and remember commas
Justine Tunney authored
68 },
7c1a56a let's try fragment caching instead
Justine Tunney authored
69 'json': {
70 'BACKEND': 'occupywallst.memcachedjson.MemcachedCacheJSON',
71 'KEY_FUNCTION': lambda key, key_prefix, version: key,
818aacc super heavy load, time to enable caching
Justine Tunney authored
72 'LOCATION': [
73 '127.0.0.1:11211',
74 ],
0a12dcc and remember commas
Justine Tunney authored
75 },
f1aad16 set up caching, fixed api wrapper to email errors and commit/rollback
Justine Tunney authored
76 }
77
43c269b don't cache pages for logged in users
Justine Tunney authored
78 CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
79
f1aad16 set up caching, fixed api wrapper to email errors and commit/rollback
Justine Tunney authored
80 BOLD = '\x1b[1m'
81 GREEN = '\x1b[32m'
82 RESET = '\x1b[0m'
83
101aa12 initial import
Justine Tunney authored
84 SITE_ID = 1
85 USE_I18N = True
7841612 don't use l10n by default D:
Justine Tunney authored
86 USE_L10N = False
101aa12 initial import
Justine Tunney authored
87 USE_THOUSAND_SEPARATOR = True
26eb534 don't secure cookie by default
Justine Tunney authored
88 SESSION_COOKIE_SECURE = False
ec81210 trying to make this goofy chat thing
Justine Tunney authored
89 SESSION_COOKIE_HTTPONLY = True
0fca519 fix csrf stuff
Justine Tunney authored
90 CSRF_COOKIE_SECURE = False
101aa12 initial import
Justine Tunney authored
91 TIME_ZONE = 'UTC'
92 DEFAULT_CHARSET = 'utf-8'
93 ROOT_URLCONF = 'occupywallst.urls'
94 LOGIN_URL = '/login/'
95 LOGOUT_URL = '/logout/'
96 LOGIN_REDIRECT_URL = '/'
d998883 better white labeling, faster/simpler verbiage system
Justine Tunney authored
97 MEDIA_URL = '/media/'
98 ADMIN_MEDIA_PREFIX = '/media/admin/'
7c1a56a let's try fragment caching instead
Justine Tunney authored
99 # SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
100 SESSION_ENGINE = 'occupywallst.memcachedjson'
744f9bb fix links in rss
Justine Tunney authored
101 USE_X_FORWARDED_HOST = True
101aa12 initial import
Justine Tunney authored
102
e138d94 article translation
Justine Tunney authored
103 gettext_noop = lambda s: s
104 LANGUAGE_CODE = 'en-us'
105 LANGUAGES = (
106 ('en', gettext_noop('English')),
0660ae2 Revert "emergency read only mode"
Justine Tunney authored
107 ('es', gettext_noop('Spanish')),
108 ('fr', gettext_noop('French')),
3fc56d6 greek language support
Justine Tunney authored
109 ('el', gettext_noop('Greek')),
df4d07a crappy arabic translations
Justine Tunney authored
110 ('ar', gettext_noop('Arabic')),
e138d94 article translation
Justine Tunney authored
111 )
112
a936ce0 cached template loader
Justine Tunney authored
113 TEMPLATE_LOADERS = (
114 ('django.template.loaders.cached.Loader', (
115 'django.template.loaders.filesystem.Loader',
116 'django.template.loaders.app_directories.Loader',
117 )),
118 )
101aa12 initial import
Justine Tunney authored
119
66caf59 more comment fixes
Justine Tunney authored
120 TEMPLATE_CONTEXT_PROCESSORS = [
101aa12 initial import
Justine Tunney authored
121 "django.contrib.auth.context_processors.auth",
122 "django.core.context_processors.debug",
123 "django.core.context_processors.i18n",
124 "django.core.context_processors.media",
125 "django.core.context_processors.static",
decead8 we now have a message board!
Justine Tunney authored
126 "django.core.context_processors.static",
101aa12 initial import
Justine Tunney authored
127 "django.core.context_processors.request",
128 "django.contrib.messages.context_processors.messages",
decead8 we now have a message board!
Justine Tunney authored
129 "occupywallst.context_processors.goodies",
85c1b07 notification system
Justine Tunney authored
130 "occupywallst.context_processors.notifications",
d998883 better white labeling, faster/simpler verbiage system
Justine Tunney authored
131 "occupywallst.context_processors.verbiage",
66caf59 more comment fixes
Justine Tunney authored
132 ]
101aa12 initial import
Justine Tunney authored
133
66caf59 more comment fixes
Justine Tunney authored
134 MIDDLEWARE_CLASSES = [
971f7c7 Add XForwardedForMiddleware middleware
Justine Tunney authored
135 'occupywallst.middleware.XForwardedForMiddleware',
101aa12 initial import
Justine Tunney authored
136 'django.middleware.common.CommonMiddleware',
f1aad16 set up caching, fixed api wrapper to email errors and commit/rollback
Justine Tunney authored
137 'django.middleware.transaction.TransactionMiddleware',
0660ae2 Revert "emergency read only mode"
Justine Tunney authored
138 'django.contrib.sessions.middleware.SessionMiddleware',
b4a1a5a ability to switch languages
Justine Tunney authored
139 'django.middleware.locale.LocaleMiddleware',
0660ae2 Revert "emergency read only mode"
Justine Tunney authored
140 'django.contrib.auth.middleware.AuthenticationMiddleware',
141 'django.contrib.messages.middleware.MessageMiddleware',
3473211 disable for now
Justine Tunney authored
142 # 'django.middleware.csrf.CsrfViewMiddleware',
143 # 'occupywallst.middleware.CsrfCookieWhenLoggedIn',
0660ae2 Revert "emergency read only mode"
Justine Tunney authored
144 'occupywallst.middleware.NeverCache',
66caf59 more comment fixes
Justine Tunney authored
145 ]
101aa12 initial import
Justine Tunney authored
146
66caf59 more comment fixes
Justine Tunney authored
147 INSTALLED_APPS = [
101aa12 initial import
Justine Tunney authored
148 'occupywallst',
149 'django.contrib.auth',
150 'django.contrib.contenttypes',
151 'django.contrib.sessions',
152 'django.contrib.admin',
153 'django.contrib.gis',
66caf59 more comment fixes
Justine Tunney authored
154 ]
f1aad16 set up caching, fixed api wrapper to email errors and commit/rollback
Justine Tunney authored
155
156 try:
157 from occupywallst.settings_local import *
158 except ImportError:
d58f34c SCHEMA CHANGE: verbiage table can now render url path templates
Justine Tunney authored
159 print >>sys.stderr, "not found: occupywallst/settings_local.py"
689fbd2 happy messages about mystery settings
Justine Tunney authored
160 else:
d58f34c SCHEMA CHANGE: verbiage table can now render url path templates
Justine Tunney authored
161 print >>sys.stderr, "loaded: occupywallst/settings_local.py"
d2a5caa javascript minification
Justine Tunney authored
162
9401368 pyflakes & pep8
Justine Tunney authored
163
61e61f9 don't re-minify if not modified
Justine Tunney authored
164 def minify():
d2a5caa javascript minification
Justine Tunney authored
165 import subprocess
166 minifier = join(project_root, "../chat/minify.js")
167 outfile = join(MEDIA_ROOT, OWS_SCRIPTS_MINIFIED)
61e61f9 don't re-minify if not modified
Justine Tunney authored
168 infiles = [abspath(join(MEDIA_ROOT, f)) for f in OWS_SCRIPTS]
d2a5caa javascript minification
Justine Tunney authored
169 if exists(outfile):
61e61f9 don't re-minify if not modified
Justine Tunney authored
170 modified = lambda fname: os.stat(fname).st_mtime
171 if modified(outfile) > max(modified(infile) for infile in infiles):
172 return
d2a5caa javascript minification
Justine Tunney authored
173 os.unlink(outfile)
174 proc = subprocess.Popen([minifier, outfile] + infiles)
175 assert proc.wait() == 0, "minifier exited non-zero"
176 assert exists(outfile), "minifier didn't produce output"
61e61f9 don't re-minify if not modified
Justine Tunney authored
177
9401368 pyflakes & pep8
Justine Tunney authored
178
61e61f9 don't re-minify if not modified
Justine Tunney authored
179 try:
180 minify()
d2a5caa javascript minification
Justine Tunney authored
181 except Exception, exc:
182 OWS_SCRIPTS_MINIFIED = ""
183 print >>sys.stderr, "javascript minifier failed:", exc
Something went wrong with that request. Please try again.