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