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