~twom/django-openid-auth/django-1.9-urls

« back to all changes in this revision

Viewing changes to example_consumer/settings.py

  • Committer: Anthony Lenton
  • Date: 2013-03-14 17:44:04 UTC
  • mfrom: (95.1.3 django-openid-auth)
  • Revision ID: anthony.lenton@canonical.com-20130314174404-5bgcxaenv161gwnh
[r=elachuni] Added Django 1.4 support to the tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
# POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
30
# Django settings for example project.
31
 
 
 
31
import django
 
32
django_version = django.get_version()
32
33
DEBUG = True
33
34
TEMPLATE_DEBUG = DEBUG
34
35
 
38
39
 
39
40
MANAGERS = ADMINS
40
41
 
41
 
DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
42
 
DATABASE_NAME = 'sqlite.db'             # Or path to database file if using sqlite3.
43
 
DATABASE_USER = ''             # Not used with sqlite3.
44
 
DATABASE_PASSWORD = ''         # Not used with sqlite3.
45
 
DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
46
 
DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
 
42
if django_version >= "1.1.2": 
 
43
    csrf_middleware = 'django.middleware.csrf.CsrfViewMiddleware'
 
44
    DATABASES = {
 
45
                     'default': {
 
46
                         'ENGINE': 'django.db.backends.sqlite3',
 
47
                         'NAME': 'sqlite.db'
 
48
                     }
 
49
                 }
 
50
    TEMPLATE_LOADERS = (
 
51
        'django.template.loaders.filesystem.Loader',
 
52
        'django.template.loaders.app_directories.Loader',
 
53
    )
 
54
else:
 
55
    csrf_middleware = 'django.contrib.csrf.middleware.CsrfViewMiddleware'
 
56
    TEMPLATE_LOADERS = (
 
57
        'django.template.loaders.filesystem.load_template_source',
 
58
        'django.template.loaders.app_directories.load_template_source',
 
59
     )
 
60
    DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
 
61
    DATABASE_NAME = 'sqlite.db'             # Or path to database file if using sqlite3.
 
62
    DATABASE_USER = ''             # Not used with sqlite3.
 
63
    DATABASE_PASSWORD = ''         # Not used with sqlite3.
 
64
    DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
 
65
    DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
47
66
 
48
67
# Local time zone for this installation. Choices can be found here:
49
68
# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
79
98
# Make this unique, and don't share it with anybody.
80
99
SECRET_KEY = '34958734985734985734985798437'
81
100
 
82
 
# List of callables that know how to import templates from various sources.
83
 
TEMPLATE_LOADERS = (
84
 
    'django.template.loaders.filesystem.load_template_source',
85
 
    'django.template.loaders.app_directories.load_template_source',
86
 
#     'django.template.loaders.eggs.load_template_source',
87
 
)
88
 
 
89
 
# django-openid-auth will *not* work with Django 1.1.1 or older, as it's
90
 
# missing the csrf_token template tag.  This will allow it to work with
91
 
# Django 1.1.2 or later:
92
 
try: 
93
 
    import django.middleware.csrf
94
 
except ImportError:
95
 
    csrf_middleware = 'django.contrib.csrf.middleware.CsrfViewMiddleware'
96
 
else:
97
 
    csrf_middleware = 'django.middleware.csrf.CsrfViewMiddleware'
98
 
 
99
101
MIDDLEWARE_CLASSES = (
100
102
    'django.middleware.common.CommonMiddleware',
101
103
    'django.contrib.sessions.middleware.SessionMiddleware',