source: mauRepo/dj_security/trunk/dj_security/settings.py @ 8894

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/dj_security/trunk/dj_security/settings.py
Revision 8894, 9.8 KB checked in by aharwood, 5 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1########################
2# MAIN DJANGO SETTINGS #
3########################
4
5# People who get code error notifications.
6# In the format (('Full Name', 'email@example.com'),
7#                ('Full Name', 'anotheremail@example.com'))
8ADMINS = (
9    ('Andrew Harwood', 'andrew.harwood@stfc.ac.uk'),
10)
11MANAGERS = ADMINS
12
13# Local time zone for this installation. Choices can be found here:
14# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
15# although not all choices may be available on all operating systems.
16# On Unix systems, a value of None will cause Django to use the same
17# timezone as the operating system.
18# If running in a Windows environment this must be set to the same as your
19# system time zone.
20TIME_ZONE = 'Europe/London'
21
22# If you set this to True, Django will use timezone-aware datetimes.
23USE_TZ = True
24
25# Language code for this installation. All choices can be found here:
26# http://www.i18nguy.com/unicode/language-identifiers.html
27LANGUAGE_CODE = 'en-gb'
28
29# A boolean that turns on/off debug mode. When set to ``True``, stack traces
30# are displayed for error pages. Should always be set to ``False`` in
31# production. Best set to ``True`` in local_settings.py
32DEBUG = False
33
34# Whether a user's session cookie expires when the Web browser is closed.
35SESSION_EXPIRE_AT_BROWSER_CLOSE = True
36
37SITE_ID = 1
38
39SITE_PREFIX = ''
40
41# If you set this to False, Django will make some optimizations so as not
42# to load the internationalization machinery.
43USE_I18N = False
44
45# Make this unique, and don't share it with anybody.
46SECRET_KEY = "26192b77-eb5c-4b91-8f38-dad220fbe2c0ce26b7cb-5630-4e46-9204-d5b4484d76af72a57e13-a680-421f-89af-0df2f355e1fb"
47
48# Tuple of IP addresses, as strings, that:
49#   * See debug comments, when DEBUG is true
50#   * Receive x-headers
51INTERNAL_IPS = ("127.0.0.1",)
52
53# List of callables that know how to import templates from various sources.
54TEMPLATE_LOADERS = (
55    "django.template.loaders.filesystem.Loader",
56    "django.template.loaders.app_directories.Loader",
57)
58
59#AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
60
61# List of finder classes that know how to find static files in
62# various locations.
63STATICFILES_FINDERS = (
64    "django.contrib.staticfiles.finders.FileSystemFinder",
65    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
66#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
67)
68
69
70#############
71# DATABASES #
72#############
73
74DATABASES = {
75    'default': {
76        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
77        'NAME': '',                      # Or path to database file if using sqlite3.
78        'USER': '',                      # Not used with sqlite3.
79        'PASSWORD': '',                  # Not used with sqlite3.
80        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
81        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
82    },
83}
84
85#########
86# PATHS #
87#########
88
89import os
90
91# Full filesystem path to the project.
92PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
93
94# Name of the directory for the project.
95PROJECT_DIRNAME = PROJECT_ROOT.split(os.sep)[-1]
96
97# Every cache key will get prefixed with this value - here we set it to
98# the name of the directory the project is in to try and use something
99# project specific.
100CACHE_MIDDLEWARE_KEY_PREFIX = PROJECT_DIRNAME
101
102# URL prefix for static files.
103# Example: "http://media.lawrence.com/static/"
104STATIC_URL = "/static/"
105
106# Absolute path to the directory static files should be collected to.
107# Don't put anything in this directory yourself; store your static files
108# in apps' "static/" subdirectories and in STATICFILES_DIRS.
109# Example: "/home/media/media.lawrence.com/static/"
110STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))
111
112# URL that handles the media served from MEDIA_ROOT. Make sure to use a
113# trailing slash.
114# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
115MEDIA_URL = STATIC_URL + "media/"
116
117# Absolute filesystem path to the directory that will hold user-uploaded files.
118# Example: "/home/media/media.lawrence.com/media/"
119MEDIA_ROOT = os.path.join(PROJECT_ROOT, *MEDIA_URL.strip("/").split("/"))
120
121# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
122# trailing slash.
123# Examples: "http://foo.com/media/", "/media/".
124ADMIN_MEDIA_PREFIX = STATIC_URL + "grappelli/"
125
126# Package/module name to import the root urlpatterns from for the project.
127ROOT_URLCONF = "%s.urls" % PROJECT_DIRNAME
128
129# Put strings here, like "/home/html/django_templates"
130# or "C:/www/django/templates".
131# Always use forward slashes, even on Windows.
132# Don't forget to use absolute paths, not relative paths.
133TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),)
134
135
136################
137# APPLICATIONS #
138################
139INSTALLED_APPS = (
140    "cedatheme_mf54",
141    "django.contrib.admin",
142    "django.contrib.auth",
143    "django.contrib.contenttypes",
144    "django.contrib.redirects",
145    "django.contrib.sessions",
146    "django.contrib.sites",
147    "django.contrib.sitemaps",
148    "django.contrib.staticfiles",
149    'django.contrib.messages',
150    'django.contrib.humanize',
151    'registration',   
152    'django_authopenid',
153    "dj_security",
154    "cookielaw",
155)
156
157# List of processors used by RequestContext to populate the context.
158# Each one should be a callable that takes the request object as its
159# only parameter and returns a dictionary to add to the context.
160TEMPLATE_CONTEXT_PROCESSORS = (
161    "django.contrib.auth.context_processors.auth",
162    "django.contrib.messages.context_processors.messages",
163    "django.core.context_processors.debug",
164    "django.core.context_processors.i18n",
165    "django.core.context_processors.static",
166    "django.core.context_processors.media",
167    "django.core.context_processors.request",
168    "django.core.context_processors.tz",
169    'django_authopenid.context_processors.authopenid',       
170)
171
172# List of middleware classes to use. Order is important; in the request phase,
173# these middleware classes will be applied in the order given, and in the
174# response phase the middleware will be applied in reverse order.
175MIDDLEWARE_CLASSES = (
176    "django.contrib.sessions.middleware.SessionMiddleware",
177    "django.contrib.auth.middleware.AuthenticationMiddleware",
178    "django.middleware.doc.XViewMiddleware",
179    "django.contrib.redirects.middleware.RedirectFallbackMiddleware",
180    "django.middleware.common.CommonMiddleware",
181    "django.middleware.csrf.CsrfViewMiddleware",
182    "django.contrib.messages.middleware.MessageMiddleware",
183    'django_authopenid.middleware.OpenIDMiddleware',
184    'dj_security.middleware.DJS_Middleware',
185)
186
187# Store these package names here as they may change in the future since
188# at the moment we are using custom forks of them.
189PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
190#PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
191
192#########################
193# OPTIONAL APPLICATIONS #
194#########################
195
196# These will be added to ``INSTALLED_APPS``, only if available.
197OPTIONAL_APPS = (
198    "debug_toolbar",
199    "django_extensions",
200    "compressor",
201#    PACKAGE_NAME_FILEBROWSER,
202#    PACKAGE_NAME_GRAPPELLI,
203)
204
205DEBUG_TOOLBAR_CONFIG = {"INTERCEPT_REDIRECTS": False}
206
207###################
208# DEPLOY SETTINGS #
209###################
210
211# These settings are used by the default fabfile.py provided.
212# Check fabfile.py for defaults.
213
214# FABRIC = {
215#     "SSH_USER": "", # SSH username
216#     "SSH_PASS":  "", # SSH password (consider key-based authentication)
217#     "SSH_KEY_PATH":  "", # Local path to SSH key file, for key-based auth
218#     "HOSTS": [], # List of hosts to deploy to
219#     "VIRTUALENV_HOME":  "", # Absolute remote path for virtualenvs
220#     "PROJECT_NAME": "", # Unique identifier for project
221#     "REQUIREMENTS_PATH": "", # Path to pip requirements, relative to project
222#     "GUNICORN_PORT": 8000, # Port gunicorn will listen on
223#     "LOCALE": "en_US.UTF-8", # Should end with ".UTF-8"
224#     "LIVE_HOSTNAME": "www.example.com", # Host for public site.
225#     "REPO_URL": "", # Git or Mercurial remote repo URL for the project
226#     "DB_PASS": "", # Live database password
227#     "ADMIN_PASS": "", # Live admin user password
228# }
229
230AUTH_PROFILE_MODULE = 'dj_security.UserProfile'
231
232# A sample logging configuration. The only tangible logging
233# performed by this configuration is to send an email to
234# the site admins on every HTTP 500 error when DEBUG=False.
235# See http://docs.djangoproject.com/en/dev/topics/logging for
236# more details on how to customize your logging configuration.
237LOGGING = {
238    'version': 1,
239    'disable_existing_loggers': False,
240    'formatters': {
241        'verbose': {
242            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
243        },
244        'simple': {
245            'format': '%(levelname)s %(message)s'
246        },
247    },
248    'filters': {
249        'require_debug_false': {
250            '()': 'django.utils.log.RequireDebugFalse'
251        }
252    },
253    'handlers': {
254        'mail_admins': {
255            'level': 'ERROR',
256            'filters': ['require_debug_false'],
257            'class': 'django.utils.log.AdminEmailHandler'
258        },
259        'console':{
260            'level':'DEBUG',
261            'class':'logging.StreamHandler',
262            'formatter': 'verbose'
263        }
264    },
265    'loggers': {
266        'django.request': {
267            'handlers': ['mail_admins'],
268            'level': 'ERROR',
269            'propagate': True,
270        },
271        'dj_security': {
272            'handlers': ['console'],
273            'level': 'DEBUG',
274            'propagate': True,
275        }
276    }
277}
278
279ALLOWED_HOSTS = ['*']
280##################
281# LOCAL SETTINGS #
282##################
283
284# Allow any settings to be defined in local_settings.py which should be
285# ignored in your version control system allowing for settings to be
286# defined per machine.
287try:
288    from local_settings import *
289except ImportError:
290    pass
Note: See TracBrowser for help on using the repository browser.