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