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