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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/dj_security/trunk/dj_security/settings.py@8708
Revision 8708, 7.5 KB checked in by mnagni, 7 years ago (diff)

wrong middleware import

  • Property svn:mime-type set to text/plain
Line 
1# Django settings for mydjango_secapp project.
2import os
3
4
5def decode_relative_path(rel_path):
6    return os.path.join(os.path.dirname(__file__), rel_path).replace('\\', '/') 
7
8DEBUG = True
9TEMPLATE_DEBUG = DEBUG
10
11ADMINS = (
12    # ('Your Name', 'your_email@example.com'),
13)
14MANAGERS = ADMINS
15JEEVES_URL = 'http://cidev1.jc.rl.ac.uk/dj_jeeves'
16
17
18DATABASES = {
19    'default': {
20        'ENGINE': 'django.db.backends.sqlite3',                 
21        'NAME': decode_relative_path('.') + '/sqlite.db',
22        'USER': '',                   
23        'PASSWORD': '',                     
24        'HOST': '',                     
25        'PORT': '',
26    }
27}
28"""
29
30DATABASES = {
31    # This parameters are usually set during
32    # the deployment configuration process
33    'default': {
34        # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.               
35        'ENGINE': 'DB_ENGINE',
36        # Or path to database file if using sqlite3.
37        'NAME': 'DB_NAME',
38        # Not used with sqlite3.                     
39        'USER': 'DB_USER',
40        # Not used with sqlite3.                     
41        'PASSWORD': 'DB_PASSWORD',
42        # Set to empty string for localhost. Not used with sqlite3.       
43        'HOST': 'DB_HOST',                     
44        # Set to empty string for default. Not used with sqlite3.       
45        'PORT': 'DB_PORT',                     
46    }
47}
48"""
49
50OPENID_AX = [
51    'http://axschema.org/contact/email'
52]
53
54
55# Local time zone for this installation. Choices can be found here:
56# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
57# although not all choices may be available on all operating systems.
58# In a Windows environment this must be set to your system time zone.
59TIME_ZONE = 'America/Chicago'
60
61# Language code for this installation. All choices can be found here:
62# http://www.i18nguy.com/unicode/language-identifiers.html
63LANGUAGE_CODE = 'en-us'
64
65SITE_ID = 1
66
67# If you set this to False, Django will make some optimizations so as not
68# to load the internationalization machinery.
69USE_I18N = True
70
71# If you set this to False, Django will not format dates, numbers and
72# calendars according to the current locale.
73USE_L10N = True
74
75# If you set this to False, Django will not use timezone-aware datetimes.
76USE_TZ = True
77
78# Absolute filesystem path to the directory that will hold user-uploaded files.
79# Example: "/home/media/media.lawrence.com/media/"
80MEDIA_ROOT = ''
81
82# URL that handles the media served from MEDIA_ROOT. Make sure to use a
83# trailing slash.
84# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
85MEDIA_URL = ''
86
87# Absolute path to the directory static files should be collected to.
88# Don't put anything in this directory yourself; store your static files
89# in apps' "static/" subdirectories and in STATICFILES_DIRS.
90# Example: "/home/media/media.lawrence.com/static/"
91STATIC_ROOT = ''
92
93# URL prefix for static files.
94# Example: "http://media.lawrence.com/static/"
95STATIC_URL = '/static/'
96
97# Additional locations of static files
98STATICFILES_DIRS = (
99    # Put strings here, like "/home/html/static" or "C:/www/django/static".
100    # Always use forward slashes, even on Windows.
101    # Don't forget to use absolute paths, not relative paths.
102)
103
104# List of finder classes that know how to find static files in
105# various locations.
106STATICFILES_FINDERS = (
107    'django.contrib.staticfiles.finders.FileSystemFinder',
108    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
109#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
110)
111
112# Make this unique, and don't share it with anybody.
113SECRET_KEY = '=+l)#o$ugq4pc14*$08q5gw(&0@nns@gm&2f=bx0_*jc1+y%w1'
114
115# List of callables that know how to import templates from various sources.
116TEMPLATE_LOADERS = (
117    'django.template.loaders.filesystem.Loader',
118    'django.template.loaders.app_directories.Loader',
119#     'django.template.loaders.eggs.Loader',
120)
121
122MIDDLEWARE_CLASSES = (
123    'django.middleware.common.CommonMiddleware',
124    'django.contrib.sessions.middleware.SessionMiddleware',
125    'django.middleware.csrf.CsrfViewMiddleware',
126    'django.contrib.auth.middleware.AuthenticationMiddleware',
127    'django.contrib.messages.middleware.MessageMiddleware',
128    'django_authopenid.middleware.OpenIDMiddleware',
129    'dj_security.middleware.DJS_Middleware',
130    # Uncomment the next line for simple clickjacking protection:
131    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
132)
133
134ROOT_URLCONF = 'dj_security.urls'
135
136# Python dotted path to the WSGI application used by Django's runserver.
137#WSGI_APPLICATION = 'dj_security.wsgi.application'
138
139TEMPLATE_DIRS = (
140    decode_relative_path('static/templates')
141    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
142    # Always use forward slashes, even on Windows.
143    # Don't forget to use absolute paths, not relative paths.
144)
145
146INSTALLED_APPS = (
147    'django.contrib.auth',
148    'django.contrib.contenttypes',
149    'django.contrib.sessions',
150    'django.contrib.sites',
151    'django.contrib.messages',
152    'django.contrib.staticfiles',
153    'registration',
154    'django.contrib.humanize',
155    'django_authopenid',
156    'dj_security',
157    # Uncomment the next line to enable the admin:
158    # 'django.contrib.admin',
159    # Uncomment the next line to enable admin documentation:
160    # 'django.contrib.admindocs',
161)
162
163NOT_ENCODE = ['password', 'backend']
164SHARED_SECRET = 'sharedsecret'   
165APPLICATION_ROOT = 'PROJECT_NAME_PAR/'
166if APPLICATION_ROOT.startswith('PROJECT_NAME_'):
167    APPLICATION_ROOT = ''
168   
169# One-week activation window; you may, of course, use a different value.   
170ACCOUNT_ACTIVATION_DAYS = 7
171
172# Adds to the site framework the current machine
173# where dj_security is deployed
174import socket
175try:
176    HOSTNAME = socket.gethostname()
177except Exception:
178    HOSTNAME = 'localhost'
179from django.contrib.sites.models import Site
180from django.db.utils import DatabaseError   
181try:
182    site = Site()
183    site.name = HOSTNAME
184    site.domain = HOSTNAME + '/' + APPLICATION_ROOT
185    site.save()
186    #Sets the default site
187    SITE_ID = site.pk
188except DatabaseError as ex:
189    print str(ex)
190
191
192
193TEMPLATE_CONTEXT_PROCESSORS = (
194    'django_authopenid.context_processors.authopenid',
195    'django.core.context_processors.i18n',
196)
197
198AUTH_PROFILE_MODULE = 'dj_security.UserProfile'
199
200# A sample logging configuration. The only tangible logging
201# performed by this configuration is to send an email to
202# the site admins on every HTTP 500 error when DEBUG=False.
203# See http://docs.djangoproject.com/en/dev/topics/logging for
204# more details on how to customize your logging configuration.
205LOGGING = {
206    'version': 1,
207    'disable_existing_loggers': False,
208    'formatters': {
209        'verbose': {
210            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
211        },
212        'simple': {
213            'format': '%(levelname)s %(message)s'
214        },
215    },
216    'filters': {
217        'require_debug_false': {
218            '()': 'django.utils.log.RequireDebugFalse'
219        }
220    },
221    'handlers': {
222        'mail_admins': {
223            'level': 'ERROR',
224            'filters': ['require_debug_false'],
225            'class': 'django.utils.log.AdminEmailHandler'
226        },
227        'console':{
228            'level':'DEBUG',
229            'class':'logging.StreamHandler',
230            'formatter': 'verbose'
231        }
232    },
233    'loggers': {
234        'django.request': {
235            'handlers': ['mail_admins'],
236            'level': 'ERROR',
237            'propagate': True,
238        },
239        'dj_security': {
240            'handlers': ['console'],
241            'level': 'DEBUG',
242            'propagate': True,
243        }
244    }
245}
Note: See TracBrowser for help on using the repository browser.