##// END OF EJS Templates
Use simple search engine by default instead of whoosh
neko259 -
r1728:f4f3de8a default
parent child Browse files
Show More
@@ -1,229 +1,228 b''
1 # Django settings for neboard project.
1 # Django settings for neboard project.
2 import os
2 import os
3
3
4 DEBUG = True
4 DEBUG = True
5
5
6 ADMINS = (
6 ADMINS = (
7 # ('Your Name', 'your_email@example.com'),
7 # ('Your Name', 'your_email@example.com'),
8 ('admin', 'admin@example.com')
8 ('admin', 'admin@example.com')
9 )
9 )
10
10
11 MANAGERS = ADMINS
11 MANAGERS = ADMINS
12
12
13 DATABASES = {
13 DATABASES = {
14 'default': {
14 'default': {
15 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
15 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
16 'NAME': 'database.db', # Or path to database file if using sqlite3.
16 'NAME': 'database.db', # Or path to database file if using sqlite3.
17 'USER': '', # Not used with sqlite3.
17 'USER': '', # Not used with sqlite3.
18 'PASSWORD': '', # Not used with sqlite3.
18 'PASSWORD': '', # Not used with sqlite3.
19 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
19 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
20 'PORT': '', # Set to empty string for default. Not used with sqlite3.
20 'PORT': '', # Set to empty string for default. Not used with sqlite3.
21 'CONN_MAX_AGE': None,
21 'CONN_MAX_AGE': None,
22 }
22 }
23 }
23 }
24
24
25 # Local time zone for this installation. Choices can be found here:
25 # Local time zone for this installation. Choices can be found here:
26 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
26 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
27 # although not all choices may be available on all operating systems.
27 # although not all choices may be available on all operating systems.
28 # In a Windows environment this must be set to your system time zone.
28 # In a Windows environment this must be set to your system time zone.
29 TIME_ZONE = 'Europe/Kiev'
29 TIME_ZONE = 'Europe/Kiev'
30
30
31 # Language code for this installation. All choices can be found here:
31 # Language code for this installation. All choices can be found here:
32 # http://www.i18nguy.com/unicode/language-identifiers.html
32 # http://www.i18nguy.com/unicode/language-identifiers.html
33 LANGUAGE_CODE = 'en'
33 LANGUAGE_CODE = 'en'
34
34
35 SITE_ID = 1
35 SITE_ID = 1
36
36
37 # If you set this to False, Django will make some optimizations so as not
37 # If you set this to False, Django will make some optimizations so as not
38 # to load the internationalization machinery.
38 # to load the internationalization machinery.
39 USE_I18N = True
39 USE_I18N = True
40
40
41 # If you set this to False, Django will not format dates, numbers and
41 # If you set this to False, Django will not format dates, numbers and
42 # calendars according to the current locale.
42 # calendars according to the current locale.
43 USE_L10N = True
43 USE_L10N = True
44
44
45 # If you set this to False, Django will not use timezone-aware datetimes.
45 # If you set this to False, Django will not use timezone-aware datetimes.
46 USE_TZ = True
46 USE_TZ = True
47
47
48 USE_ETAGS = True
48 USE_ETAGS = True
49
49
50 # Absolute filesystem path to the directory that will hold user-uploaded files.
50 # Absolute filesystem path to the directory that will hold user-uploaded files.
51 # Example: "/home/media/media.lawrence.com/media/"
51 # Example: "/home/media/media.lawrence.com/media/"
52 MEDIA_ROOT = './media/'
52 MEDIA_ROOT = './media/'
53
53
54 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
54 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
55 # trailing slash.
55 # trailing slash.
56 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
56 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
57 MEDIA_URL = '/media/'
57 MEDIA_URL = '/media/'
58
58
59 # Absolute path to the directory static files should be collected to.
59 # Absolute path to the directory static files should be collected to.
60 # Don't put anything in this directory yourself; store your static files
60 # Don't put anything in this directory yourself; store your static files
61 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
61 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
62 # Example: "/home/media/media.lawrence.com/static/"
62 # Example: "/home/media/media.lawrence.com/static/"
63 STATIC_ROOT = ''
63 STATIC_ROOT = ''
64
64
65 # URL prefix for static files.
65 # URL prefix for static files.
66 # Example: "http://media.lawrence.com/static/"
66 # Example: "http://media.lawrence.com/static/"
67 STATIC_URL = '/static/'
67 STATIC_URL = '/static/'
68
68
69 STATICFILES_DIRS = []
69 STATICFILES_DIRS = []
70
70
71 # List of finder classes that know how to find static files in
71 # List of finder classes that know how to find static files in
72 # various locations.
72 # various locations.
73 STATICFILES_FINDERS = (
73 STATICFILES_FINDERS = (
74 'django.contrib.staticfiles.finders.FileSystemFinder',
74 'django.contrib.staticfiles.finders.FileSystemFinder',
75 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
75 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
76 )
76 )
77
77
78 if DEBUG:
78 if DEBUG:
79 STATICFILES_STORAGE = \
79 STATICFILES_STORAGE = \
80 'django.contrib.staticfiles.storage.StaticFilesStorage'
80 'django.contrib.staticfiles.storage.StaticFilesStorage'
81 else:
81 else:
82 STATICFILES_STORAGE = \
82 STATICFILES_STORAGE = \
83 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
83 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
84
84
85 # Make this unique, and don't share it with anybody.
85 # Make this unique, and don't share it with anybody.
86 SECRET_KEY = '@1rc$o(7=tt#kd+4s$u6wchm**z^)4x90)7f6z(i&55@o11*8o'
86 SECRET_KEY = '@1rc$o(7=tt#kd+4s$u6wchm**z^)4x90)7f6z(i&55@o11*8o'
87
87
88 TEMPLATES = [{
88 TEMPLATES = [{
89 'BACKEND': 'django.template.backends.django.DjangoTemplates',
89 'BACKEND': 'django.template.backends.django.DjangoTemplates',
90 'DIRS': ['templates'],
90 'DIRS': ['templates'],
91 'OPTIONS': {
91 'OPTIONS': {
92 'loaders': [
92 'loaders': [
93 ('django.template.loaders.cached.Loader', [
93 ('django.template.loaders.cached.Loader', [
94 'django.template.loaders.filesystem.Loader',
94 'django.template.loaders.filesystem.Loader',
95 'django.template.loaders.app_directories.Loader',
95 'django.template.loaders.app_directories.Loader',
96 ]),
96 ]),
97 ],
97 ],
98 'context_processors': [
98 'context_processors': [
99 'django.template.context_processors.csrf',
99 'django.template.context_processors.csrf',
100 'django.contrib.auth.context_processors.auth',
100 'django.contrib.auth.context_processors.auth',
101 'boards.context_processors.user_and_ui_processor',
101 'boards.context_processors.user_and_ui_processor',
102 ],
102 ],
103 },
103 },
104 }]
104 }]
105
105
106
106
107 MIDDLEWARE_CLASSES = [
107 MIDDLEWARE_CLASSES = [
108 'django.middleware.http.ConditionalGetMiddleware',
108 'django.middleware.http.ConditionalGetMiddleware',
109 'django.contrib.sessions.middleware.SessionMiddleware',
109 'django.contrib.sessions.middleware.SessionMiddleware',
110 'django.middleware.locale.LocaleMiddleware',
110 'django.middleware.locale.LocaleMiddleware',
111 'django.middleware.common.CommonMiddleware',
111 'django.middleware.common.CommonMiddleware',
112 'django.contrib.auth.middleware.AuthenticationMiddleware',
112 'django.contrib.auth.middleware.AuthenticationMiddleware',
113 'django.contrib.messages.middleware.MessageMiddleware',
113 'django.contrib.messages.middleware.MessageMiddleware',
114 'boards.middlewares.BanMiddleware',
114 'boards.middlewares.BanMiddleware',
115 'boards.middlewares.TimezoneMiddleware',
115 'boards.middlewares.TimezoneMiddleware',
116 ]
116 ]
117
117
118 ROOT_URLCONF = 'neboard.urls'
118 ROOT_URLCONF = 'neboard.urls'
119
119
120 # Python dotted path to the WSGI application used by Django's runserver.
120 # Python dotted path to the WSGI application used by Django's runserver.
121 WSGI_APPLICATION = 'neboard.wsgi.application'
121 WSGI_APPLICATION = 'neboard.wsgi.application'
122
122
123 INSTALLED_APPS = (
123 INSTALLED_APPS = (
124 'django.contrib.auth',
124 'django.contrib.auth',
125 'django.contrib.contenttypes',
125 'django.contrib.contenttypes',
126 'django.contrib.sessions',
126 'django.contrib.sessions',
127 'django.contrib.staticfiles',
127 'django.contrib.staticfiles',
128 # Uncomment the next line to enable the admin:
128 # Uncomment the next line to enable the admin:
129 'django.contrib.admin',
129 'django.contrib.admin',
130 # Uncomment the next line to enable admin documentation:
130 # Uncomment the next line to enable admin documentation:
131 # 'django.contrib.admindocs',
131 # 'django.contrib.admindocs',
132 'django.contrib.messages',
132 'django.contrib.messages',
133
133
134 'debug_toolbar',
134 'debug_toolbar',
135
135
136 # Search
136 # Search
137 'haystack',
137 'haystack',
138
138
139 'boards',
139 'boards',
140 )
140 )
141
141
142 # A sample logging configuration. The only tangible logging
142 # A sample logging configuration. The only tangible logging
143 # performed by this configuration is to send an email to
143 # performed by this configuration is to send an email to
144 # the site admins on every HTTP 500 error when DEBUG=False.
144 # the site admins on every HTTP 500 error when DEBUG=False.
145 # See http://docs.djangoproject.com/en/dev/topics/logging for
145 # See http://docs.djangoproject.com/en/dev/topics/logging for
146 # more details on how to customize your logging configuration.
146 # more details on how to customize your logging configuration.
147 LOGGING = {
147 LOGGING = {
148 'version': 1,
148 'version': 1,
149 'disable_existing_loggers': False,
149 'disable_existing_loggers': False,
150 'formatters': {
150 'formatters': {
151 'verbose': {
151 'verbose': {
152 'format': '%(levelname)s %(asctime)s %(name)s %(process)d %(thread)d %(message)s'
152 'format': '%(levelname)s %(asctime)s %(name)s %(process)d %(thread)d %(message)s'
153 },
153 },
154 'simple': {
154 'simple': {
155 'format': '%(levelname)s %(asctime)s [%(name)s] %(message)s'
155 'format': '%(levelname)s %(asctime)s [%(name)s] %(message)s'
156 },
156 },
157 },
157 },
158 'filters': {
158 'filters': {
159 'require_debug_false': {
159 'require_debug_false': {
160 '()': 'django.utils.log.RequireDebugFalse'
160 '()': 'django.utils.log.RequireDebugFalse'
161 }
161 }
162 },
162 },
163 'handlers': {
163 'handlers': {
164 'console': {
164 'console': {
165 'level': 'DEBUG',
165 'level': 'DEBUG',
166 'class': 'logging.StreamHandler',
166 'class': 'logging.StreamHandler',
167 'formatter': 'simple'
167 'formatter': 'simple'
168 },
168 },
169 },
169 },
170 'loggers': {
170 'loggers': {
171 'boards': {
171 'boards': {
172 'handlers': ['console'],
172 'handlers': ['console'],
173 'level': 'DEBUG',
173 'level': 'DEBUG',
174 }
174 }
175 },
175 },
176 }
176 }
177
177
178 HAYSTACK_CONNECTIONS = {
178 HAYSTACK_CONNECTIONS = {
179 'default': {
179 'default': {
180 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
180 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
181 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
182 },
181 },
183 }
182 }
184
183
185 THEMES = [
184 THEMES = [
186 ('md', 'Mystic Dark'),
185 ('md', 'Mystic Dark'),
187 ('md_centered', 'Mystic Dark (centered)'),
186 ('md_centered', 'Mystic Dark (centered)'),
188 ('sw', 'Snow White'),
187 ('sw', 'Snow White'),
189 ('pg', 'Photon Gray'),
188 ('pg', 'Photon Gray'),
190 ]
189 ]
191
190
192 IMAGE_VIEWERS = [
191 IMAGE_VIEWERS = [
193 ('simple', 'Simple'),
192 ('simple', 'Simple'),
194 ('popup', 'Popup'),
193 ('popup', 'Popup'),
195 ]
194 ]
196
195
197 ALLOWED_HOSTS = ['*']
196 ALLOWED_HOSTS = ['*']
198
197
199 POSTING_DELAY = 20 # seconds
198 POSTING_DELAY = 20 # seconds
200
199
201 # Websocket settins
200 # Websocket settins
202 CENTRIFUGE_HOST = 'localhost'
201 CENTRIFUGE_HOST = 'localhost'
203 CENTRIFUGE_PORT = '9090'
202 CENTRIFUGE_PORT = '9090'
204
203
205 CENTRIFUGE_ADDRESS = 'http://{}:{}'.format(CENTRIFUGE_HOST, CENTRIFUGE_PORT)
204 CENTRIFUGE_ADDRESS = 'http://{}:{}'.format(CENTRIFUGE_HOST, CENTRIFUGE_PORT)
206 CENTRIFUGE_PROJECT_ID = '<project id here>'
205 CENTRIFUGE_PROJECT_ID = '<project id here>'
207 CENTRIFUGE_PROJECT_SECRET = '<project secret here>'
206 CENTRIFUGE_PROJECT_SECRET = '<project secret here>'
208 CENTRIFUGE_TIMEOUT = 5
207 CENTRIFUGE_TIMEOUT = 5
209
208
210 SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
209 SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
211
210
212 # Debug middlewares
211 # Debug middlewares
213 MIDDLEWARE_CLASSES += [
212 MIDDLEWARE_CLASSES += [
214 'debug_toolbar.middleware.DebugToolbarMiddleware',
213 'debug_toolbar.middleware.DebugToolbarMiddleware',
215 ]
214 ]
216
215
217
216
218 def custom_show_toolbar(request):
217 def custom_show_toolbar(request):
219 return request.user.has_perm('admin.debug')
218 return request.user.has_perm('admin.debug')
220
219
221 DEBUG_TOOLBAR_CONFIG = {
220 DEBUG_TOOLBAR_CONFIG = {
222 'ENABLE_STACKTRACES': True,
221 'ENABLE_STACKTRACES': True,
223 'SHOW_TOOLBAR_CALLBACK': 'neboard.settings.custom_show_toolbar',
222 'SHOW_TOOLBAR_CALLBACK': 'neboard.settings.custom_show_toolbar',
224 }
223 }
225
224
226 # FIXME Uncommenting this fails somehow. Need to investigate this
225 # FIXME Uncommenting this fails somehow. Need to investigate this
227 #DEBUG_TOOLBAR_PANELS += (
226 #DEBUG_TOOLBAR_PANELS += (
228 # 'debug_toolbar.panels.profiling.ProfilingDebugPanel',
227 # 'debug_toolbar.panels.profiling.ProfilingDebugPanel',
229 #)
228 #)
@@ -1,66 +1,66 b''
1 # INTRO #
1 # INTRO #
2
2
3 This project aims to create centralized forum-like discussion platform with
3 This project aims to create centralized forum-like discussion platform with
4 anonymity in mind.
4 anonymity in mind.
5
5
6 Main repository: https://bitbucket.org/neko259/neboard/
6 Main repository: https://bitbucket.org/neko259/neboard/
7
7
8 Site: http://neboard.me/
8 Site: http://neboard.me/
9
9
10 # INSTALLATION #
10 # INSTALLATION #
11
11
12 1. Download application and move inside it:
12 1. Download application and move inside it:
13
13
14 `hg clone https://bitbucket.org/neko259/neboard`
14 `hg clone https://bitbucket.org/neko259/neboard`
15
15
16 `cd neboard`
16 `cd neboard`
17
17
18 2. Install all application dependencies:
18 2. Install all application dependencies:
19
19
20 Some minimal system-wide depenencies:
20 Some minimal system-wide depenencies:
21
21
22 * python3
22 * python3
23 * pip/pip3
23 * pip/pip3
24 * jpeg
24 * jpeg
25
25
26 Python dependencies:
26 Python dependencies:
27
27
28 `pip3 install -r requirements.txt`
28 `pip3 install -r requirements.txt`
29
29
30 You can use virtualenv to speed up the process or avoid conflicts.
30 You can use virtualenv to speed up the process or avoid conflicts.
31
31
32 3. Setup a database in `neboard/settings.py`. You can also change other settings like search engine.
32 3. Setup a database in `neboard/settings.py`. You can also change other settings like search engine.
33
33
34 Depending on configured database and search engine, you need to install corresponding dependencies manually.
34 Depending on configured database and search engine, you need to install corresponding dependencies manually.
35
35
36 Default database is *sqlite*, default search engine is *whoosh*.
36 Default database is *sqlite*, default search engine is *simple*.
37
37
38 4. Setup SECRET_KEY to a secret value in `neboard/settings.py
38 4. Setup SECRET_KEY to a secret value in `neboard/settings.py
39 5. Run `./manage.py migrate` to apply all migrations
39 5. Run `./manage.py migrate` to apply all migrations
40 6. Apply config changes to `boards/config/config.ini`. You can see the default settings in `boards/config/default_config.ini`
40 6. Apply config changes to `boards/config/config.ini`. You can see the default settings in `boards/config/default_config.ini`
41 7. If you want to use decetral engine, run `./manage.py generate_keypair` to generate keys
41 7. If you want to use decetral engine, run `./manage.py generate_keypair` to generate keys
42
42
43 # RUNNING #
43 # RUNNING #
44
44
45 You can run the server using django default embedded webserver by running:
45 You can run the server using django default embedded webserver by running:
46
46
47 ./manage.py runserver <address>:<port>
47 ./manage.py runserver <address>:<port>
48
48
49 See django-admin command help for details.
49 See django-admin command help for details.
50
50
51 Also consider using wsgi or fcgi interfaces on production servers.
51 Also consider using wsgi or fcgi interfaces on production servers.
52
52
53 When running for the first time, you need to setup at least one section tag.
53 When running for the first time, you need to setup at least one section tag.
54 Go to the admin page and manually create one tag with "required" property set.
54 Go to the admin page and manually create one tag with "required" property set.
55
55
56 # UPGRADE #
56 # UPGRADE #
57
57
58 1. Backup your project data.
58 1. Backup your project data.
59 2. Copy the project contents over the old project directory
59 2. Copy the project contents over the old project directory
60 3. Run migrations by `./manage.py migrate`
60 3. Run migrations by `./manage.py migrate`
61
61
62 You can also just clone the mercurial project and pull it to update
62 You can also just clone the mercurial project and pull it to update
63
63
64 # CONCLUSION #
64 # CONCLUSION #
65
65
66 Enjoy our software and thank you! No newline at end of file
66 Enjoy our software and thank you!
General Comments 0
You need to be logged in to leave comments. Login now