adapted setting for CMS
[unfold.git] / myslice / settings.py
1 # -*- coding: utf-8 -*-
2 # Django settings for myslice project.
3
4 import os
5 gettext = lambda s: s
6 PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
7
8 import os.path
9
10 DEBUG = True
11 TEMPLATE_DEBUG = DEBUG
12
13 # compute ROOT from where this file is installed
14 # should fit every need including developers
15 # but you can redefine ROOT if that's not working for you
16 try:
17     # get the directory where this file is
18     ROOT=os.path.dirname(__file__) or '.'
19     # move one step up
20     ROOT=os.path.realpath(ROOT+'/..')
21 except:
22     ROOT=None
23     if DEBUG:
24         import traceback
25         traceback.print_exc()
26
27 if not ROOT:
28     raise Exception,"Cannot find ROOT for myslice"
29
30 ####################
31 ADMINS = (
32     # ('your_name', 'your_email@test.com'),
33 )
34
35 MANAGERS = ADMINS
36
37 # Mail configuration
38 #DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
39 #EMAIL_HOST_PASSWORD = "mypassword"
40
41 EMAIL_HOST = "localhost"
42 EMAIL_PORT = 25
43 EMAIL_USE_TLS = False
44
45
46
47
48
49 DATABASES = {
50     'default': {
51         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
52         'NAME': os.path.join(ROOT,'myslice.sqlite3'), # Or path to database file if using sqlite3.
53         'USER': '',                      # Not used with sqlite3.
54         'PASSWORD': '',                  # Not used with sqlite3.
55         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
56         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
57     }
58 }
59
60 # Local time zone for this installation. Choices can be found here:
61 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
62 # although not all choices may be available on all operating systems.
63 # In a Windows environment this must be set to your system time zone.
64 TIME_ZONE = 'America/Chicago'
65
66 # Language code for this installation. All choices can be found here:
67 # http://www.i18nguy.com/unicode/language-identifiers.html
68 LANGUAGE_CODE = 'en-us'
69
70 SITE_ID = 1
71
72 # If you set this to False, Django will make some optimizations so as not
73 # to load the internationalization machinery.
74 USE_I18N = True
75
76 # If you set this to False, Django will not format dates, numbers and
77 # calendars according to the current locale.
78 USE_L10N = True
79
80 # If you set this to False, Django will not use timezone-aware datetimes.
81 USE_TZ = True
82
83 # Absolute filesystem path to the directory that will hold user-uploaded files.
84 # Example: "/home/media/media.lawrence.com/media/"
85 MEDIA_ROOT = ''
86
87 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
88 # trailing slash.
89 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
90 MEDIA_URL = ''
91
92 # Absolute path to the directory static files should be collected to.
93 # Don't put anything in this directory yourself; store your static files
94 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
95 # Example: "/home/media/media.lawrence.com/static/"
96 STATIC_ROOT = os.path.join(ROOT,'django-static')
97
98 # URL prefix for static files.
99 # Example: "http://media.lawrence.com/static/"
100 STATIC_URL = '/all-static/'
101
102 # Additional locations of static files
103 STATICFILES_DIRS = (
104     # Put strings here, like "/home/html/static" or "C:/www/django/static".
105     # Always use forward slashes, even on Windows.
106     # Don't forget to use absolute paths, not relative paths.
107     os.path.join(ROOT,'all-static'),
108 )
109
110 # List of finder classes that know how to find static files in
111 # various locations.
112 STATICFILES_FINDERS = (
113     'django.contrib.staticfiles.finders.FileSystemFinder',
114     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
115 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
116 )
117
118 # Make this unique, and don't share it with anybody.
119 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
120
121 # List of callables that know how to import templates from various sources.
122 TEMPLATE_LOADERS = (
123     'django.template.loaders.filesystem.Loader',
124     'django.template.loaders.app_directories.Loader',
125 #     'django.template.loaders.eggs.Loader',
126 )
127
128 MIDDLEWARE_CLASSES = (
129     'django.middleware.common.CommonMiddleware',
130     'django.contrib.sessions.middleware.SessionMiddleware',
131     'django.middleware.csrf.CsrfViewMiddleware',
132     'django.contrib.auth.middleware.AuthenticationMiddleware',
133     'django.contrib.messages.middleware.MessageMiddleware',
134     # Uncomment the next line for simple clickjacking protection:
135     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
136
137     # CMS
138     'cms.middleware.multilingual.MultilingualURLMiddleware',
139     'cms.middleware.page.CurrentPageMiddleware',
140     'cms.middleware.user.CurrentUserMiddleware',
141     'cms.middleware.toolbar.ToolbarMiddleware',
142 )
143
144 # CMS
145 TEMPLATE_CONTEXT_PROCESSORS = (
146     'django.contrib.auth.context_processors.auth',
147     'django.core.context_processors.i18n',
148     'django.core.context_processors.request',
149     'django.core.context_processors.media',
150     'django.core.context_processors.static',
151     'cms.context_processors.media',
152     'sekizai.context_processors.sekizai',
153 )
154
155
156 ROOT_URLCONF = 'myslice.urls'
157
158 # Python dotted path to the WSGI application used by Django's runserver.
159 WSGI_APPLICATION = 'myslice.wsgi.application'
160
161 TEMPLATE_DIRS = (
162     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
163     # Always use forward slashes, even on Windows.
164     # Don't forget to use absolute paths, not relative paths.
165     os.path.join(ROOT,"all-templates"),
166
167     # CMS
168     os.path.join(PROJECT_PATH, "templates"),
169 )
170
171 # CMS
172 CMS_TEMPLATES = (
173     ('template_1.html', 'Template One'),
174     ('template_2.html', 'Template Two'),
175 )
176 LANGUAGES = [
177     ('en', 'English'),
178 ]
179
180 INSTALLED_APPS = (
181     'django.contrib.auth',
182     'django.contrib.contenttypes',
183     'django.contrib.sessions',
184     'django.contrib.sites',
185     'django.contrib.messages',
186     'django.contrib.staticfiles',
187     # handling the {% insert %} and {% container %} tags
188     # see details in devel/django-insert-above-1.0-4
189     'insert_above',
190     # our django project
191     'myslice',
192     # the core of the UI
193     'auth', 'manifold', 'unfold',
194     # plugins
195     'plugins',
196     # views - more or less stable 
197     'views',
198     'trash',
199     # Uncomment the next line to enable the admin:
200     'django.contrib.admin',
201     # Uncomment the next line to enable admin documentation:
202     # 'django.contrib.admindocs',
203     'portal',
204 # DEPRECATED #    'django.contrib.formtools',
205 # DEPRECATED ##    'crispy_forms',
206 # DEPRECATED #
207 # DEPRECATED #    # User registration
208 # DEPRECATED #    'django.contrib.auth',
209 # DEPRECATED #    'django.contrib.sites',
210 # DEPRECATED #    'registration',
211
212     # CMS : Django CMS
213     'cms',     # django CMS itself
214     'mptt',    # utilities for implementing a modified pre-order traversal tree
215     'menus',   # helper for model independent hierarchical website navigation
216     'south',   # intelligent schema and data migrations
217     'sekizai', # for javascript and css management
218     # + plugins:
219     'cms.plugins.flash',
220     'cms.plugins.googlemap'
221     'cms.plugins.link',
222     'cms.plugins.snippet',
223     'cms.plugins.text',
224     'cms.plugins.twitter',
225     # either
226     'cms.plugins.file',
227     'cms.plugins.picture',
228     'cms.plugins.teaser',
229     'cms.plugins.video',
230     # or
231     #'filer',
232     #'cmsplugin_filer_file',
233     #'cmsplugin_filer_folder',
234     #'cmsplugin_filer_image',
235     #'cmsplugin_filer_teaser',
236     #'cmsplugin_filer_video',
237
238     # Versioning of content 
239     'reversion',
240 )
241
242 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
243
244 # A sample logging configuration. The only tangible logging
245 # performed by this configuration is to send an email to
246 # the site admins on every HTTP 500 error when DEBUG=False.
247 # See http://docs.djangoproject.com/en/dev/topics/logging for
248 # more details on how to customize your logging configuration.
249 LOGGING = {
250     'version': 1,
251     'disable_existing_loggers': False,
252     'filters': {
253         'require_debug_false': {
254             '()': 'django.utils.log.RequireDebugFalse'
255         }
256     },
257     'handlers': {
258         'mail_admins': {
259             'level': 'ERROR',
260             'filters': ['require_debug_false'],
261             'class': 'django.utils.log.AdminEmailHandler',
262         }
263     },
264     'loggers': {
265         'django.request': {
266             'handlers': ['mail_admins'],
267             'level': 'ERROR',
268             'propagate': True,
269         },
270     }
271 }
272
273 AUTHENTICATION_BACKENDS = ( 'auth.backend.MyCustomBackend', 'auth.manifoldbackend.ManifoldBackend', )
274
275 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
276 # without this setting django will return a 403 forbidden error, which is fine
277 # if you need to see the error message then use this setting
278 CSRF_FAILURE_VIEW = 'manifold.manifoldproxy.csrf_failure'
279
280 #################### for insert_above
281 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
282 # put stuff under static/
283 # IA_MEDIA_PREFIX = '/code/'
284