~deej/django-openid-auth/deb-build

« back to all changes in this revision

Viewing changes to example_consumer/settings.py

  • Committer: Natalia
  • Date: 2015-04-23 20:02:39 UTC
  • mto: This revision was merged to the branch mainline in revision 113.
  • Revision ID: natalia.bidart@ubuntu.com-20150423200239-398aidg4rl3bolj8
Fully test suite passing on djangos from 1.4 to 1.8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
28
# POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
 
# Django settings for example project.
 
30
"""
 
31
Django settings for example_consumer project.
 
32
 
 
33
For more information on this file, see
 
34
https://docs.djangoproject.com/en/1.7/topics/settings/
 
35
 
 
36
For the full list of settings and their values, see
 
37
https://docs.djangoproject.com/en/1.7/ref/settings/
 
38
"""
 
39
 
 
40
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 
41
import os
31
42
import django
32
 
django_version = django.get_version()
 
43
 
 
44
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
 
45
 
 
46
 
 
47
# Quick-start development settings - unsuitable for production
 
48
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
 
49
 
 
50
# SECURITY WARNING: keep the secret key used in production secret!
 
51
SECRET_KEY = '34958734985734985734985798437'
 
52
 
 
53
# SECURITY WARNING: don't run with debug turned on in production!
33
54
DEBUG = True
34
 
TEMPLATE_DEBUG = DEBUG
35
 
 
36
 
ADMINS = (
37
 
    # ('Your Name', 'your_email@domain.com'),
38
 
)
39
 
 
40
 
MANAGERS = ADMINS
41
 
 
42
 
if django_version >= "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.
66
 
 
67
 
# Local time zone for this installation. Choices can be found here:
68
 
# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
69
 
# although not all variations may be possible on all operating systems.
70
 
# If running in a Windows environment this must be set to the same as your
71
 
# system time zone.
72
 
TIME_ZONE = 'America/Chicago'
73
 
 
74
 
# Language code for this installation. All choices can be found here:
75
 
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
76
 
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
77
 
LANGUAGE_CODE = 'en-us'
78
 
 
79
 
SITE_ID = 1
80
 
 
81
 
# If you set this to False, Django will make some optimizations so as not
82
 
# to load the internationalization machinery.
83
 
USE_I18N = True
84
 
 
85
 
# Absolute path to the directory that holds media.
86
 
# Example: "/home/media/media.lawrence.com/"
87
 
MEDIA_ROOT = ''
88
 
 
89
 
# URL that handles the media served from MEDIA_ROOT.
90
 
# Example: "http://media.lawrence.com"
91
 
MEDIA_URL = ''
92
 
 
93
 
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
94
 
# trailing slash.
95
 
# Examples: "http://foo.com/media/", "/media/".
96
 
ADMIN_MEDIA_PREFIX = '/media/'
97
 
 
98
 
# Make this unique, and don't share it with anybody.
99
 
SECRET_KEY = '34958734985734985734985798437'
 
55
 
 
56
TEMPLATE_DEBUG = True
 
57
 
 
58
ALLOWED_HOSTS = []
100
59
 
101
60
MIDDLEWARE_CLASSES = (
102
61
    'django.middleware.common.CommonMiddleware',
103
62
    'django.contrib.sessions.middleware.SessionMiddleware',
104
63
    'django.contrib.auth.middleware.AuthenticationMiddleware',
105
 
    csrf_middleware,
106
 
)
107
 
 
108
 
ROOT_URLCONF = 'example_consumer.urls'
109
 
 
110
 
TEMPLATE_DIRS = (
111
 
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
112
 
    # Always use forward slashes, even on Windows.
113
 
    # Don't forget to use absolute paths, not relative paths.
114
 
)
 
64
    'django.middleware.csrf.CsrfViewMiddleware',
 
65
)
 
66
 
 
67
# Application definition
115
68
 
116
69
INSTALLED_APPS = (
117
70
    'django.contrib.auth',
119
72
    'django.contrib.sessions',
120
73
    'django.contrib.admin',
121
74
    'django_openid_auth',
122
 
    'south',
123
75
)
124
76
 
 
77
if django.VERSION < (1, 7):
 
78
    INSTALLED_APPS += ('south',)
 
79
 
 
80
ROOT_URLCONF = 'example_consumer.urls'
 
81
 
 
82
WSGI_APPLICATION = 'example_consumer.wsgi.application'
 
83
 
 
84
# Database
 
85
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
 
86
 
 
87
DATABASES = {
 
88
    'default': {
 
89
        'ENGINE': 'django.db.backends.sqlite3',
 
90
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
 
91
    }
 
92
}
 
93
 
 
94
# Internationalization
 
95
# https://docs.djangoproject.com/en/1.7/topics/i18n/
 
96
 
 
97
LANGUAGE_CODE = 'en-us'
 
98
 
 
99
TIME_ZONE = 'UTC'
 
100
 
 
101
USE_I18N = True
 
102
 
 
103
USE_TZ = True
 
104
 
 
105
# Static files (CSS, JavaScript, Images)
 
106
# https://docs.djangoproject.com/en/1.7/howto/static-files/
 
107
 
 
108
STATIC_URL = '/static/'
 
109
 
 
110
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
 
111
 
125
112
AUTHENTICATION_BACKENDS = (
126
113
    'django_openid_auth.auth.OpenIDBackend',
127
114
    'django.contrib.auth.backends.ModelBackend',
144
131
 
145
132
# If set, always use this as the identity URL rather than asking the
146
133
# user.  This only makes sense if it is a server URL.
147
 
OPENID_SSO_SERVER_URL = 'https://login.launchpad.net/'
 
134
OPENID_SSO_SERVER_URL = 'https://login.ubuntu.com/'
148
135
 
149
136
# Tell django.contrib.auth to use the OpenID signin URLs.
150
137
LOGIN_URL = '/openid/login/'
151
138
LOGIN_REDIRECT_URL = '/'
152
139
 
153
140
# Should django_auth_openid be used to sign into the admin interface?
154
 
OPENID_USE_AS_ADMIN_LOGIN = False
 
141
OPENID_USE_AS_ADMIN_LOGIN = True