Show More
@@ -1,217 +1,239 b'' | |||
|
1 | 1 | # Django settings for neboard project. |
|
2 | 2 | import os |
|
3 | import markdown | |
|
4 | 3 | from boards.mdx_neboard import markdown_extended |
|
5 | 4 | |
|
6 | 5 | DEBUG = True |
|
7 | 6 | TEMPLATE_DEBUG = DEBUG |
|
8 | 7 | |
|
9 | 8 | ADMINS = ( |
|
10 | 9 | # ('Your Name', 'your_email@example.com'), |
|
11 | 10 | ('admin', 'admin@example.com') |
|
12 | 11 | ) |
|
13 | 12 | |
|
14 | 13 | MANAGERS = ADMINS |
|
15 | 14 | |
|
16 | 15 | DATABASES = { |
|
17 | 16 | 'default': { |
|
18 | 17 | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. |
|
19 | 18 | 'NAME': 'database.db', # Or path to database file if using sqlite3. |
|
20 | 19 | 'USER': '', # Not used with sqlite3. |
|
21 | 20 | 'PASSWORD': '', # Not used with sqlite3. |
|
22 | 21 | 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. |
|
23 | 22 | 'PORT': '', # Set to empty string for default. Not used with sqlite3. |
|
24 | 23 | } |
|
25 | 24 | } |
|
26 | 25 | |
|
27 | 26 | # Local time zone for this installation. Choices can be found here: |
|
28 | 27 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
|
29 | 28 | # although not all choices may be available on all operating systems. |
|
30 | 29 | # In a Windows environment this must be set to your system time zone. |
|
31 | 30 | TIME_ZONE = 'Europe/Kiev' |
|
32 | 31 | |
|
33 | 32 | # Language code for this installation. All choices can be found here: |
|
34 | 33 | # http://www.i18nguy.com/unicode/language-identifiers.html |
|
35 | 34 | LANGUAGE_CODE = 'en' |
|
36 | 35 | |
|
37 | 36 | SITE_ID = 1 |
|
38 | 37 | |
|
39 | 38 | # If you set this to False, Django will make some optimizations so as not |
|
40 | 39 | # to load the internationalization machinery. |
|
41 | 40 | USE_I18N = True |
|
42 | 41 | |
|
43 | 42 | # If you set this to False, Django will not format dates, numbers and |
|
44 | 43 | # calendars according to the current locale. |
|
45 | 44 | USE_L10N = True |
|
46 | 45 | |
|
47 | 46 | # If you set this to False, Django will not use timezone-aware datetimes. |
|
48 | 47 | USE_TZ = True |
|
49 | 48 | |
|
50 | 49 | # Absolute filesystem path to the directory that will hold user-uploaded files. |
|
51 | 50 | # Example: "/home/media/media.lawrence.com/media/" |
|
52 | 51 | MEDIA_ROOT = './media/' |
|
53 | 52 | |
|
54 | 53 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a |
|
55 | 54 | # trailing slash. |
|
56 | 55 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" |
|
57 | 56 | MEDIA_URL = '/media/' |
|
58 | 57 | |
|
59 | 58 | # Absolute path to the directory static files should be collected to. |
|
60 | 59 | # Don't put anything in this directory yourself; store your static files |
|
61 | 60 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. |
|
62 | 61 | # Example: "/home/media/media.lawrence.com/static/" |
|
63 | 62 | STATIC_ROOT = '' |
|
64 | 63 | |
|
65 | 64 | # URL prefix for static files. |
|
66 | 65 | # Example: "http://media.lawrence.com/static/" |
|
67 | 66 | STATIC_URL = '/static/' |
|
68 | 67 | |
|
69 | 68 | # Additional locations of static files |
|
70 | 69 | # It is really a hack, put real paths, not related |
|
71 | 70 | STATICFILES_DIRS = ( |
|
72 | 71 | os.path.dirname(__file__) + '/boards/static', |
|
73 | 72 | |
|
74 | 73 | # '/d/work/python/django/neboard/neboard/boards/static', |
|
75 | 74 | # Put strings here, like "/home/html/static" or "C:/www/django/static". |
|
76 | 75 | # Always use forward slashes, even on Windows. |
|
77 | 76 | # Don't forget to use absolute paths, not relative paths. |
|
78 | 77 | ) |
|
79 | 78 | |
|
80 | 79 | # List of finder classes that know how to find static files in |
|
81 | 80 | # various locations. |
|
82 | 81 | STATICFILES_FINDERS = ( |
|
83 | 82 | 'django.contrib.staticfiles.finders.FileSystemFinder', |
|
84 | 83 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
85 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | |
|
86 | 84 | ) |
|
87 | 85 | |
|
88 | 86 | if DEBUG: |
|
89 | 87 | STATICFILES_STORAGE = \ |
|
90 | 88 | 'django.contrib.staticfiles.storage.StaticFilesStorage' |
|
91 | 89 | else: |
|
92 | 90 | STATICFILES_STORAGE = \ |
|
93 | 91 | 'django.contrib.staticfiles.storage.CachedStaticFilesStorage' |
|
94 | 92 | |
|
95 | 93 | # Make this unique, and don't share it with anybody. |
|
96 | 94 | SECRET_KEY = '@1rc$o(7=tt#kd+4s$u6wchm**z^)4x90)7f6z(i&55@o11*8o' |
|
97 | 95 | |
|
98 | 96 | # List of callables that know how to import templates from various sources. |
|
99 | 97 | TEMPLATE_LOADERS = ( |
|
100 | 98 | 'django.template.loaders.filesystem.Loader', |
|
101 | 99 | 'django.template.loaders.app_directories.Loader', |
|
102 | # 'django.template.loaders.eggs.Loader', | |
|
103 | 100 | ) |
|
104 | 101 | |
|
105 | 102 | TEMPLATE_CONTEXT_PROCESSORS = ( |
|
106 | 103 | 'django.core.context_processors.media', |
|
107 | 104 | 'django.core.context_processors.static', |
|
108 | 105 | 'django.core.context_processors.request', |
|
109 | 106 | 'django.contrib.auth.context_processors.auth', |
|
110 | 107 | ) |
|
111 | 108 | |
|
112 | 109 | MIDDLEWARE_CLASSES = ( |
|
113 | 110 | 'django.contrib.sessions.middleware.SessionMiddleware', |
|
114 | 111 | 'django.middleware.locale.LocaleMiddleware', |
|
115 | 112 | 'django.middleware.common.CommonMiddleware', |
|
116 | # 'django.middleware.csrf.CsrfViewMiddleware', | |
|
117 | 113 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
118 | 114 | 'django.contrib.messages.middleware.MessageMiddleware', |
|
119 | # Uncomment the next line for simple clickjacking protection: | |
|
120 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware' | |
|
121 | 115 | 'boards.middlewares.BanMiddleware', |
|
122 | 116 | ) |
|
123 | 117 | |
|
124 | 118 | ROOT_URLCONF = 'neboard.urls' |
|
125 | 119 | |
|
126 | 120 | # Python dotted path to the WSGI application used by Django's runserver. |
|
127 | 121 | WSGI_APPLICATION = 'neboard.wsgi.application' |
|
128 | 122 | |
|
129 | 123 | TEMPLATE_DIRS = ( |
|
130 | 124 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
|
131 | 125 | # Always use forward slashes, even on Windows. |
|
132 | 126 | # Don't forget to use absolute paths, not relative paths. |
|
133 | 127 | 'templates', |
|
134 | 128 | ) |
|
135 | 129 | |
|
136 | 130 | INSTALLED_APPS = ( |
|
137 | 131 | 'django.contrib.auth', |
|
138 | 132 | 'django.contrib.contenttypes', |
|
139 | 133 | 'django.contrib.sessions', |
|
140 | 134 | # 'django.contrib.sites', |
|
141 | 135 | 'django.contrib.messages', |
|
142 | 136 | 'django.contrib.staticfiles', |
|
143 | 137 | # Uncomment the next line to enable the admin: |
|
144 | 138 | 'django.contrib.admin', |
|
145 | 139 | # Uncomment the next line to enable admin documentation: |
|
146 | 140 | # 'django.contrib.admindocs', |
|
147 | 141 | 'django.contrib.markup', |
|
148 | 142 | 'django.contrib.humanize', |
|
149 | 143 | 'django_cleanup', |
|
150 | 144 | 'boards', |
|
151 | 145 | 'captcha', |
|
152 | 146 | 'south', |
|
147 | 'debug_toolbar', | |
|
148 | ) | |
|
149 | ||
|
150 | DEBUG_TOOLBAR_PANELS = ( | |
|
151 | 'debug_toolbar.panels.version.VersionDebugPanel', | |
|
152 | 'debug_toolbar.panels.timer.TimerDebugPanel', | |
|
153 | 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', | |
|
154 | 'debug_toolbar.panels.headers.HeaderDebugPanel', | |
|
155 | 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', | |
|
156 | 'debug_toolbar.panels.template.TemplateDebugPanel', | |
|
157 | 'debug_toolbar.panels.sql.SQLDebugPanel', | |
|
158 | 'debug_toolbar.panels.signals.SignalDebugPanel', | |
|
159 | 'debug_toolbar.panels.logger.LoggingPanel', | |
|
153 | 160 | ) |
|
154 | 161 | |
|
155 | 162 | # TODO: NEED DESIGN FIXES |
|
156 | 163 | CAPTCHA_OUTPUT_FORMAT = (u' %(hidden_field)s ' |
|
157 | 164 | u'<div class="form-label">%(image)s</div>' |
|
158 | 165 | u'<div class="form-text">%(text_field)s</div>') |
|
159 | 166 | |
|
160 | 167 | # A sample logging configuration. The only tangible logging |
|
161 | 168 | # performed by this configuration is to send an email to |
|
162 | 169 | # the site admins on every HTTP 500 error when DEBUG=False. |
|
163 | 170 | # See http://docs.djangoproject.com/en/dev/topics/logging for |
|
164 | 171 | # more details on how to customize your logging configuration. |
|
165 | 172 | LOGGING = { |
|
166 | 173 | 'version': 1, |
|
167 | 174 | 'disable_existing_loggers': False, |
|
168 | 175 | 'filters': { |
|
169 | 176 | 'require_debug_false': { |
|
170 | 177 | '()': 'django.utils.log.RequireDebugFalse' |
|
171 | 178 | } |
|
172 | 179 | }, |
|
173 | 180 | 'handlers': { |
|
174 | 181 | 'mail_admins': { |
|
175 | 182 | 'level': 'ERROR', |
|
176 | 183 | 'filters': ['require_debug_false'], |
|
177 | 184 | 'class': 'django.utils.log.AdminEmailHandler' |
|
178 | 185 | } |
|
179 | 186 | }, |
|
180 | 187 | 'loggers': { |
|
181 | 188 | 'django.request': { |
|
182 | 189 | 'handlers': ['mail_admins'], |
|
183 | 190 | 'level': 'ERROR', |
|
184 | 191 | 'propagate': True, |
|
185 | 192 | }, |
|
186 | 193 | } |
|
187 | 194 | } |
|
188 | 195 | |
|
189 | 196 | MARKUP_FIELD_TYPES = ( |
|
190 | 197 | ('markdown', markdown_extended), |
|
191 | 198 | ) |
|
192 | 199 | # Custom imageboard settings |
|
200 | # TODO These should me moved to | |
|
193 | 201 | MAX_POSTS_PER_THREAD = 10 # Thread bumplimit |
|
194 | 202 | MAX_THREAD_COUNT = 500 # Old threads will be deleted to preserve this count |
|
195 | 203 | THREADS_PER_PAGE = 10 |
|
196 | 204 | SITE_NAME = 'Neboard' |
|
197 | 205 | |
|
198 | 206 | THEMES = [ |
|
199 | 207 | ('md', 'Mystic Dark'), |
|
200 | 208 | ('md_centered', 'Mystic Dark (centered)'), |
|
201 | 209 | ('sw', 'Snow White'), |
|
202 | 210 | ('pg', 'Photon Gray'), |
|
203 | 211 | ] |
|
204 | 212 | |
|
205 | 213 | DEFAULT_THEME = 'md' |
|
206 | 214 | |
|
207 | 215 | POPULAR_TAGS = 10 |
|
208 | 216 | LAST_REPLIES_COUNT = 3 |
|
209 | 217 | |
|
210 | 218 | ENABLE_CAPTCHA = False |
|
211 | 219 | # if user tries to post before CAPTCHA_DEFAULT_SAFE_TIME. Captcha will be shown |
|
212 | 220 | CAPTCHA_DEFAULT_SAFE_TIME = 30 # seconds |
|
213 | 221 | POSTING_DELAY = 30 # seconds |
|
214 | 222 | |
|
223 | ||
|
224 | def custom_show_toolbar(request): | |
|
225 | return DEBUG | |
|
226 | ||
|
227 | DEBUG_TOOLBAR_CONFIG = { | |
|
228 | 'INTERCEPT_REDIRECTS': False, | |
|
229 | 'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, | |
|
230 | 'HIDE_DJANGO_SQL': False, | |
|
231 | 'ENABLE_STACKTRACES': True, | |
|
232 | } | |
|
233 | ||
|
215 | 234 | # Debug mode middlewares |
|
216 | 235 | if DEBUG: |
|
217 | MIDDLEWARE_CLASSES += ('boards.profiler.ProfilerMiddleware',) | |
|
236 | MIDDLEWARE_CLASSES += ( | |
|
237 | 'boards.profiler.ProfilerMiddleware', | |
|
238 | 'debug_toolbar.middleware.DebugToolbarMiddleware', | |
|
239 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now