moves all the static files under ~/static, for convenience again, even
[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     os.path.join(ROOT,'static'),
84 )
85
86 # List of finder classes that know how to find static files in
87 # various locations.
88 STATICFILES_FINDERS = (
89     'django.contrib.staticfiles.finders.FileSystemFinder',
90     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
91 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
92 )
93
94 # Make this unique, and don't share it with anybody.
95 SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
96
97 # List of callables that know how to import templates from various sources.
98 TEMPLATE_LOADERS = (
99     'django.template.loaders.filesystem.Loader',
100     'django.template.loaders.app_directories.Loader',
101 #     'django.template.loaders.eggs.Loader',
102 )
103
104 MIDDLEWARE_CLASSES = (
105     'django.middleware.common.CommonMiddleware',
106     'django.contrib.sessions.middleware.SessionMiddleware',
107     'django.middleware.csrf.CsrfViewMiddleware',
108     'django.contrib.auth.middleware.AuthenticationMiddleware',
109     'django.contrib.messages.middleware.MessageMiddleware',
110     # Uncomment the next line for simple clickjacking protection:
111     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
112 )
113
114 ROOT_URLCONF = 'myslice.urls'
115
116 # Python dotted path to the WSGI application used by Django's runserver.
117 WSGI_APPLICATION = 'myslice.wsgi.application'
118
119 TEMPLATE_DIRS = (
120     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
121     # Always use forward slashes, even on Windows.
122     # Don't forget to use absolute paths, not relative paths.
123     os.path.join(ROOT,"templates"),
124 )
125
126 INSTALLED_APPS = (
127     'django.contrib.auth',
128     'django.contrib.contenttypes',
129     'django.contrib.sessions',
130     'django.contrib.sites',
131     'django.contrib.messages',
132     'django.contrib.staticfiles',
133     # see details in devel/django-insert-above-1.0-4
134     'insert_above',
135     'myslice',
136     'auth',
137     'slice',
138     # Uncomment the next line to enable the admin:
139     # 'django.contrib.admin',
140     # Uncomment the next line to enable admin documentation:
141     # 'django.contrib.admindocs',
142 )
143
144 # A sample logging configuration. The only tangible logging
145 # performed by this configuration is to send an email to
146 # the site admins on every HTTP 500 error when DEBUG=False.
147 # See http://docs.djangoproject.com/en/dev/topics/logging for
148 # more details on how to customize your logging configuration.
149 LOGGING = {
150     'version': 1,
151     'disable_existing_loggers': False,
152     'filters': {
153         'require_debug_false': {
154             '()': 'django.utils.log.RequireDebugFalse'
155         }
156     },
157     'handlers': {
158         'mail_admins': {
159             'level': 'ERROR',
160             'filters': ['require_debug_false'],
161             'class': 'django.utils.log.AdminEmailHandler',
162         }
163     },
164     'loggers': {
165         'django.request': {
166             'handlers': ['mail_admins'],
167             'level': 'ERROR',
168             'propagate': True,
169         },
170     }
171 }
172
173 AUTHENTICATION_BACKENDS = ( 'auth.backend.MyCustomBackend', )
174
175 #################### for insert_above
176 #IA_JS_FORMAT = "<script type='text/javascript' src='{URL}' />"
177 # put stuff under static/
178 # IA_MEDIA_PREFIX = '/code/'