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