49d2f64e49d43b2ba70704354a08df35fb3d83ee
[cookbook.git] / example / settings.py
1 # Django settings for web project.
2
3 import os
4 import os.path
5
6
7 # This is where we'll put the non-Python portions of the app
8 # (e.g. templates) and store state information (e.g. the SQLite
9 # database).  This should be an absolute path.
10 DEFAULT_DATA_DIRECTORY = os.path.abspath(os.path.join(
11         os.path.dirname(__file__), 'data'))
12 DATA_DIRECTORY = os.environ.get('DJANGO_COOKBOOK_DATA', DEFAULT_DATA_DIRECTORY)
13
14
15 DEBUG = True
16 TEMPLATE_DEBUG = DEBUG
17
18 ADMINS = (
19     ('W. Trevor King', 'wking@drexel.edu'),
20 )
21
22 MANAGERS = ADMINS
23
24 DATABASES = {
25     'default': {
26         #'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
27         'ENGINE': 'django.db.backends.sqlite3',
28         'NAME': os.path.join(DATA_DIRECTORY, 'sqlite3.db'),  # 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 # On Unix systems, a value of None will cause Django to use the same
40 # timezone as the operating system.
41 # If running in a Windows environment this must be set to the same as your
42 # system time zone.
43 TIME_ZONE = None  # 'America/New_York'
44
45 # Language code for this installation. All choices can be found here:
46 # http://www.i18nguy.com/unicode/language-identifiers.html
47 LANGUAGE_CODE = 'en-us'
48
49 SITE_ID = 1
50
51 # If you set this to False, Django will make some optimizations so as not
52 # to load the internationalization machinery.
53 USE_I18N = True
54
55 # If you set this to False, Django will not format dates, numbers and
56 # calendars according to the current locale
57 USE_L10N = 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 = os.path.join(DATA_DIRECTORY, 'media')
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 = '/media/'
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(DATA_DIRECTORY, 'static')
73
74 # URL prefix for static files.
75 # Example: "http://media.lawrence.com/static/"
76 STATIC_URL = '/static/'
77
78 # URL prefix for admin static files -- CSS, JavaScript and images.
79 # Make sure to use a trailing slash.
80 # Examples: "http://foo.com/static/admin/", "/static/admin/".
81 #ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
82 ADMIN_MEDIA_PREFIX = STATIC_URL + 'grappelli/'
83
84 # Additional locations of static files
85 STATICFILES_DIRS = (
86     # Put strings here, like "/home/html/static" or "C:/www/django/static".
87     # Always use forward slashes, even on Windows.
88     # Don't forget to use absolute paths, not relative paths.
89 )
90
91 # List of finder classes that know how to find static files in
92 # various locations.
93 STATICFILES_FINDERS = (
94     'django.contrib.staticfiles.finders.FileSystemFinder',
95     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
96 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
97 )
98
99 # Make this unique, and don't share it with anybody.
100 SECRET_KEY = 'wq-)fb$0kv*_q%=ufhaqm7$qw(w84=izd7a!nn)5i@@l)!%3x='
101
102 # List of callables that know how to import templates from various sources.
103 TEMPLATE_LOADERS = (
104     'django.template.loaders.filesystem.Loader',
105     'django.template.loaders.app_directories.Loader',
106 #     'django.template.loaders.eggs.Loader',
107 )
108
109 MIDDLEWARE_CLASSES = (
110     'django.middleware.common.CommonMiddleware',
111     'django.contrib.sessions.middleware.SessionMiddleware',
112     'django.middleware.csrf.CsrfViewMiddleware',
113     'django.contrib.auth.middleware.AuthenticationMiddleware',
114     'django.contrib.messages.middleware.MessageMiddleware',
115 )
116
117 ROOT_URLCONF = 'cookbook.urls'
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 )
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     # Uncomment the next line to enable the admin:
133     'grappelli',
134     'django.contrib.admin',
135     # Uncomment the next line to enable admin documentation:
136     # 'django.contrib.admindocs',
137     'cookbook',
138     'taggit',
139 )
140
141 # Required for render_table
142 #   http://django-tables2.readthedocs.org/en/latest/#render-table
143 TEMPLATE_CONTEXT_PROCESSORS = (
144     "django.contrib.auth.context_processors.auth",
145     "django.core.context_processors.debug",
146     "django.core.context_processors.i18n",
147     "django.core.context_processors.media",
148     "django.core.context_processors.static",
149     "django.contrib.messages.context_processors.messages",
150     "django.core.context_processors.request",
151 )
152
153 # A sample logging configuration. The only tangible logging
154 # performed by this configuration is to send an email to
155 # the site admins on every HTTP 500 error.
156 # See http://docs.djangoproject.com/en/dev/topics/logging for
157 # more details on how to customize your logging configuration.
158 LOGGING = {
159     'version': 1,
160     'disable_existing_loggers': False,
161     'handlers': {
162         'mail_admins': {
163             'level': 'ERROR',
164             'class': 'django.utils.log.AdminEmailHandler'
165         }
166     },
167     'loggers': {
168         'django.request': {
169             'handlers': ['mail_admins'],
170             'level': 'ERROR',
171             'propagate': True,
172         },
173     }
174 }