root/settings.py

Revision 1355:430fcad78cf5, 8.3 kB (checked in by [email protected]…, 8 months ago)

search support

Line  
1 # -*- coding: utf-8 -*-
2
3 #
4 # DO NOT EDIT THIS FILE!
5 #
6 # If you want to make your own changes, do them in settings_local.py.  All
7 # variables set in the settings_local.py will override corresponding values from
8 # settings.py
9 #
10
11 import os.path
12 import sys
13
14 PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))
15
16 sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))
17 sys.path.insert(0, os.path.join(PROJECT_ROOT, 'compat'))
18
19 DEBUG = True
20
21 from lib.threadlocals import SiteIDHook
22
23 DATABASE_ENGINE = 'sqlite3'
24 DATABASE_NAME = os.path.join(PROJECT_ROOT, 'byteflow.db')
25
26 ADMINS = (
27     # ('Your Name', '[email protected]'),
28 )
29
30 MANAGERS = ADMINS
31
32 # Defaults -- set these in settings_local.py
33 TIME_ZONE = 'GMT'
34 LANGUAGE_CODE = 'en-us'
35
36 SITE_ID = SiteIDHook()
37
38 # If you set this to False, Django will make some optimizations so as not
39 # to load the internationalization machinery.
40 USE_I18N = True
41
42 # Absolute path to the directory that holds media.
43 # Example: "/home/media/media.lawrence.com/"
44 MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
45 STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
46
47 # URL that handles the media served from MEDIA_ROOT.
48 # Example: "http://media.lawrence.com"
49 MEDIA_URL = '/media/'
50 STATIC_URL = '/static/'
51
52 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
53 # trailing slash.
54 # Examples: "http://foo.com/media/", "/media/".
55 ADMIN_MEDIA_PREFIX = '/admin-media/'
56
57 # Don't share it with anybody
58 if not hasattr(globals(), 'SECRET_KEY'):
59     SECRET_FILE = os.path.join(PROJECT_ROOT, 'secret.txt')
60     try:
61         SECRET_KEY = open(SECRET_FILE).read().strip()
62     except IOError:
63         try:
64             import string, random
65             SECRET_KEY = ''.join(random.choice(string.printable) for i in xrange(50))
66             secret = file(SECRET_FILE, 'w')
67             secret.write(SECRET_KEY)
68             secret.close()
69         except IOError:
70             raise Exception('Please create a %s file with random characters to set your secret key' % SECRET_FILE)
71
72 # List of callables that know how to import templates from various sources.
73 TEMPLATE_LOADERS = (
74     'lib.template_loaders.get_theme_template',
75     'django.template.loaders.filesystem.load_template_source',
76     'django.template.loaders.app_directories.load_template_source',
77 #     'django.template.loaders.eggs.load_template_source',
78 )
79
80 MIDDLEWARE_CLASSES = (
81     'django.middleware.common.CommonMiddleware',
82     'middleware.dynamicsite.DynamicSiteMiddleware', # before feedburner
83     'middleware.feedburner.FeedburnerMiddleware',
84     'lib.threadlocals.ThreadLocalsMiddleware',
85     'django.contrib.sessions.middleware.SessionMiddleware',
86     'middleware.url.UrlMiddleware',
87     'django.middleware.locale.LocaleMiddleware',
88     'django.contrib.auth.middleware.AuthenticationMiddleware',
89     'maintenancemode.middleware.MaintenanceModeMiddleware',
90     'middleware.redirect.RedirectMiddleware',
91     'openidconsumer.middleware.OpenIDMiddleware',
92     'django.middleware.doc.XViewMiddleware',
93     'middleware.ajax_errors.AjaxMiddleware',
94     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
95     'pingback.middleware.PingbackMiddleware',
96 )
97
98 TEMPLATE_CONTEXT_PROCESSORS = [
99     "django.core.context_processors.auth",
100     "django.core.context_processors.debug",
101     "django.core.context_processors.i18n",
102     "django.core.context_processors.media",
103     "django.core.context_processors.request",
104     "context_processors.settings_vars",
105 ]
106
107 AUTHENTICATION_BACKENDS = (
108     'django.contrib.auth.backends.ModelBackend',
109     'accounts.backends.CommentApprovingBackend',
110     'accounts.backends.EmailBackend',
111     'openidconsumer.backend.OpenidBackend',
112 )
113
114 ROOT_URLCONF = 'urls'
115
116 TEMPLATE_DIRS = (
117     os.path.join(PROJECT_ROOT, 'templates'),
118 )
119
120 # Here are included application necessary for work
121 # All other should go to the ADDITIONAL_APPS
122 INSTALLED_APPS = (
123     'django.contrib.auth',
124     'django.contrib.contenttypes',
125     'django.contrib.sessions',
126     'django.contrib.sites',
127     'django.contrib.admin',
128     'django.contrib.sitemaps',
129     'django.contrib.flatpages',
130     'django.contrib.markup',
131     'lib',
132     'pytils',
133     'accounts',
134     'blog',
135     'discussion',
136     'tagging',
137     'typogrify',
138     'render',
139     'postimage',
140     'openidconsumer',
141     'openidserver',
142     'revcanonical',
143 )
144
145 APPEND_SLASH = False
146 REMOVE_WWW = True
147 SITE_PROTOCOL = 'http'
148 THEME = 'default'
149
150 # App settings
151 PAGINATE_BY = 10
152 NAME_LENGTH = 256
153 DATE_FORMAT = "j.m.Y"
154 TIME_FORMAT = "G:i"
155 ACTION_RECORD_DAYS = 3
156 # Set to integer value to close comments after this number of days
157 COMMENTS_EXPIRE_DAYS = None
158 # Set to True to disable rel="nofollow" in comments
159 COMMENTS_FOLLOW = False
160
161 # Possible choices are: ''|'simple'|'recaptcha'
162 # To utilize recaptcha you must get public/private keys
163 # from http://recaptcha.net/
164 CAPTCHA=''
165 RECAPTCHA = {'example.com': {'public': '', 'private': ''}}
166
167 # Tagging
168 FORCE_LOWERCASE_TAGS = True
169
170 # OpenID
171 OPENID_WITH_AUTH = True
172 OPENID_REDIRECT_NEXT = '/'
173
174 # Pingback
175 PINGBACK_SERVER = {
176     'post_detail': 'pingback.getters.post_get',
177     }
178 PINGBACK_RESPONSE_LENGTH = 200
179
180 # TODO: move this list to DB
181 DIRECTORY_URLS = (
182     'http://www.google.com/webmasters/tools/ping',
183     'http://ping.blogs.yandex.ru/RPC2',
184     'http://rpc.technorati.com/rpc/ping',
185     )
186
187 # Default markup language for you posts. Choices are bbcode, text, html, markdown
188 RENDER_METHOD = 'markdown'
189
190 # Gravatar options
191 GRAVATAR_ENABLE = False
192 DEFAULT_AVATAR_IMG = 'avatar.jpg'
193 DEFAULT_AVATAR_SIZE = 80
194 DEFAULT_AVATAR_PATH = MEDIA_URL + 'avatars/'
195
196 #if "false" robots application would not use auto-generated sitemap.xml
197 ROBOTS_USE_SITEMAP = True
198
199 # Root urlconf component for all blog urls
200 BLOG_URLCONF_ROOT = 'blog/' # Don't forget that there must be no leading '/'
201 # Meaningful values:
202 # - 'blog.views.process_root_request': will redirect to BLOG_URLCONF_ROOT
203 # - 'blog.views.post_list': will display list of posts
204 # - 'life.views.life_index': will display list of your life flow,
205 #    requires enabled 'life' application
206 URL_ROOT_HANDLER = 'blog.views.process_root_request'
207
208 # Some defaults
209 APPEND_MTIME_TO_STATIC = True # Modification time will be appended in media_css and media_js templatetags
210 WYSIWYG_ENABLE = False # WYSIWYG for post text in admin
211 ANONYMOUS_COMMENTS_APPROVED = False # Do anonymous comments become autoapproved?
212 DEBUG_SQL = False # Show debug information about sql queries at the bottom of page
213 SHORT_POSTS_IN_FEED = False # Show full post in feed
214 USE_ATOM = True # Atom is standard, so we're using it by default
215 FEEDBURNER = {} # Feedburner disabled by default
216
217 # Postimage settings
218 POSTIMAGE_ROOT = MEDIA_ROOT
219 POSTIMAGE_URL = MEDIA_URL
220
221 STATIC_PAGES = (
222     # Name, url, title. When bool(name) is False, separator will be inserted
223     ('About', '/about/', 'About me'),
224     ('Blog', '/%s' % BLOG_URLCONF_ROOT, 'Main place'),
225     )
226
227 # See all choices in apps/blog/templatetags/bookmarks.py
228 SOCIAL_BOOKMARKS = ('delicious', 'reddit', 'slashdot', 'digg', 'technorati', 'google')
229
230 LOCALE_PATHS = (os.path.join(PROJECT_ROOT, 'locale'), )
231 THEMES_DIR = os.path.join(PROJECT_ROOT, "themes") # Byteflow themes. Your themes can be out of PROJECT_ROOT.
232 TEMPLATE_DEBUG = DEBUG
233 TAGGING_AUTOCOMPLETE_JS_BASE_URL = os.path.join(STATIC_URL, 'js')
234
235 # haystack settings
236 # set False if you have ./manage.py update_index in your cron tasks
237 HAYSTACK_SEARCH_AUTOUPDATE = True
238 HAYSTACK_SITECONF = 'apps.search' # don't change it
239 HAYSTACK_SEARCH_RESULTS_PER_PAGE = 20
240 HAYSTACK_SEARCH_ENGINE = 'whoosh' # whoosh | solr | xapian | dummy
241 # see http://haystacksearch.org/docs/tutorial.html#configuration
242 HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_ROOT, '.search')
243 HAYSTACK_XAPIAN_PATH = os.path.join(PROJECT_ROOT, '.search')
244 HAYSTACK_SOLR_URL = 'http://localhost:8983/solr'
245
246 try:
247     from settings_local import *
248 except ImportError:
249     import sys
250     sys.stderr.write('Unable to read settings_local.py\n')
251     # Convenient defaults
252     DEBUG = False
253     ADDITIONAL_APPS = ('pingback', 'watchlist')
254
255 if not hasattr(globals(), 'THEME_STATIC_ROOT'):
256    THEME_STATIC_ROOT = os.path.join(STATIC_ROOT, THEME + '/')
257
258 if not hasattr(globals(), 'THEME_STATIC_URL'):
259    THEME_STATIC_URL = os.path.join(STATIC_URL, THEME + '/')
260
261 try:
262     INSTALLED_APPS += ADDITIONAL_APPS
263 except NameError:
264     pass
265
266 try:
267     MIDDLEWARE_CLASSES += ADDITIONAL_MIDDLEWARE
268 except NameError:
269     pass
270
271 if DEBUG:
272     MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ('middleware.profile.ProfilerMiddleware', )
Note: See TracBrowser for help on using the browser.