2dbb8618cead965936ad73a64a693a3ccf1f0272
[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 not ROOT:
23     raise Exception,"Cannot find ROOT for myslice"
24
25 ####################
26 ADMINS = (
27     # ('Your Name', 'your_email@example.com'),
28 )
29
30 MANAGERS = ADMINS
31
32 DATABASES = {
33     'default': {
34         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
35         'NAME': os.path.join(ROOT,'myslice.sqlite3'), # Or path to database file if using sqlite3.
36         'USER': '',                      # Not used with sqlite3.
37         'PASSWORD': '',                  # Not used with sqlite3.
38         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
39         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
40     }
41 }
42
43 # Local time zone for this installation. Choices can be found here:
44 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
45 # although not all choices may be available on all operating systems.
46 # In a Windows environment this must be set to your system time zone.
47 TIME_ZONE = 'America/Chicago'
48
49 # Language code for this installation. All choices can be found here:
50 # http://www.i18nguy.com/unicode/language-identifiers.html
51 LANGUAGE_CODE = 'en-us'
52
53 SITE_ID = 1
54
55 # If you set this to False, Django will make some optimizations so as not
56 # to load the internationalization machinery.
57 USE_I18N = True
58
59 # If you set this to False, Django will not format dates, numbers and
60 # calendars according to the current locale.
61 USE_L10N = True
62
63 # If you set this to False, Django will not use timezone-aware datetimes.
64 USE_TZ = True
65
66 # Absolute filesystem path to the directory that will hold user-uploaded files.
67 # Example: "/home/media/media.lawrence.com/media/"
68 MEDIA_ROOT = ''
69
70 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
71 # trailing slash.
72 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
73 MEDIA_URL = ''
74
75 # Absolute path to the directory static files should be collected to.
76 # Don't put anything in this directory yourself; store your static files
77 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
78 # Example: "/home/media/media.lawrence.com/static/"
79 STATIC_ROOT = os.path.join(ROOT,'django-static')
80
81 # URL prefix for static files.
82 # Example: "http://media.lawrence.com/static/"
83 STATIC_URL = '/all-static/'
84
85 # Additional locations of static files
86 STATICFILES_DIRS = (
87     # Put strings here, like "/home/html/static" or "C:/www/django/static".
88     # Always use forward slashes, even on Windows.
89     # Don't forget to use absolute paths, not relative paths.
90     os.path.join(ROOT,'all-static'),
91 )
92
93 # List of finder classes that know how to find static files in
94 # various locations.
95 STATICFILES_FINDERS = (
96     'django.contrib.staticfiles.finders.FileSystemFinder',
97     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
98 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
99 )
100
101 # Make this unique, and don't share it with anybody.
102 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
103
104 # List of callables that know how to import templates from various sources.
105 TEMPLATE_LOADERS = (
106     'django.template.loaders.filesystem.Loader',
107     'django.template.loaders.app_directories.Loader',
108 #     'django.template.loaders.eggs.Loader',
109 )
110
111 MIDDLEWARE_CLASSES = (
112     'django.middleware.common.CommonMiddleware',
113     'django.contrib.sessions.middleware.SessionMiddleware',
114     'django.middleware.csrf.CsrfViewMiddleware',
115     'django.contrib.auth.middleware.AuthenticationMiddleware',
116     'django.contrib.messages.middleware.MessageMiddleware',
117     # Uncomment the next line for simple clickjacking protection:
118     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
119 )
120
121 ROOT_URLCONF = 'myslice.urls'
122
123 # Python dotted path to the WSGI application used by Django's runserver.
124 WSGI_APPLICATION = 'myslice.wsgi.application'
125
126 TEMPLATE_DIRS = (
127     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
128     # Always use forward slashes, even on Windows.
129     # Don't forget to use absolute paths, not relative paths.
130     os.path.join(ROOT,"all-templates"),
131 )
132
133 INSTALLED_APPS = (
134     'django.contrib.auth',
135     'django.contrib.contenttypes',
136     'django.contrib.sessions',
137     'django.contrib.sites',
138     'django.contrib.messages',
139     'django.contrib.staticfiles',
140     # handling the {% insert %} and {% container %} tags
141     # see details in devel/django-insert-above-1.0-4
142     'insert_above',
143     # our django project
144     'myslice',
145     # the core of the UI
146     'auth', 'manifold', 'unfold',
147     # plugins
148     'plugins',
149     # views - more or less stable 
150     'views',
151     'trash',
152     # Uncomment the next line to enable the admin:
153     # 'django.contrib.admin',
154     # Uncomment the next line to enable admin documentation:
155     # 'django.contrib.admindocs',
156 )
157
158 # A sample logging configuration. The only tangible logging
159 # performed by this configuration is to send an email to
160 # the site admins on every HTTP 500 error when DEBUG=False.
161 # See http://docs.djangoproject.com/en/dev/topics/logging for
162 # more details on how to customize your logging configuration.
163 LOGGING = {
164     'version': 1,
165     'disable_existing_loggers': False,
166     'filters': {
167         'require_debug_false': {
168             '()': 'django.utils.log.RequireDebugFalse'
169         }
170     },
171     'handlers': {
172         'mail_admins': {
173             'level': 'ERROR',
174             'filters': ['require_debug_false'],
175             'class': 'django.utils.log.AdminEmailHandler',
176         }
177     },
178     'loggers': {
179         'django.request': {
180             'handlers': ['mail_admins'],
181             'level': 'ERROR',
182             'propagate': True,
183         },
184     }
185 }
186
187 AUTHENTICATION_BACKENDS = ( 'auth.backend.MyCustomBackend', 'auth.manifoldbackend.ManifoldBackend', )
188
189 ### the view to redirect malformed (i.e. with a wrong CSRF) incoming requests
190 # without this setting django will return a 403 forbidden error, which is fine
191 # if you need to see the error message then use this setting
192 CSRF_FAILURE_VIEW = 'manifold.manifoldproxy.csrf_failure'
193
194 #################### for insert_above
195 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
196 # put stuff under static/
197 # IA_MEDIA_PREFIX = '/code/'
198