Add basic functionality for self-registration.
[cas.git] / src / cas / settings.py
1 # -*- coding: utf-8 -*-
2 from os import path
3
4 PROJECT_ROOT = path.realpath(path.dirname(__file__))
5
6 DEBUG = True
7 TEMPLATE_DEBUG = DEBUG
8
9 ADMINS = [
10 ]
11
12 MANAGERS = ADMINS
13
14 DATABASES = {
15     'default': {
16         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
17         'NAME': path.join(PROJECT_ROOT, 'dev.sqlite'), # Or path to database file if using sqlite3.
18         'USER': '',                      # Not used with sqlite3.
19         'PASSWORD': '',                  # Not used with sqlite3.
20         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
21         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
22     }
23 }
24
25 # Local time zone for this installation. Choices can be found here:
26 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
27 # although not all choices may be available on all operating systems.
28 # If running in a Windows environment this must be set to the same as your
29 # system time zone.
30 TIME_ZONE = None
31
32 # Language code for this installation. All choices can be found here:
33 # http://www.i18nguy.com/unicode/language-identifiers.html
34 LANGUAGE_CODE = 'pl'
35
36 SITE_ID = 1
37
38 # If you set this to False, Django will make some optimizations so as not
39 # to load the internationalization machinery.
40 USE_I18N = True
41
42 # Absolute path to the directory that holds media.
43 # Example: "/home/media/media.lawrence.com/"
44 MEDIA_ROOT = path.join(PROJECT_ROOT, '../../media/')
45
46 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
47 # trailing slash if there is a path component (optional in other cases).
48 # Examples: "http://media.lawrence.com", "http://example.com/media/"
49 MEDIA_URL = '/media/'
50
51 STATIC_ROOT = path.join(PROJECT_ROOT, '../../static/')
52 STATIC_URL = '/static/'
53
54 STATICFILES_DIRS = [
55     path.join(PROJECT_ROOT, 'static'),
56 ]
57
58 ROOT_URLCONF = 'cas.urls'
59
60 TEMPLATE_DIRS = (
61     PROJECT_ROOT + '/templates',
62 )
63
64 LOCALE_PATHS = (
65     PROJECT_ROOT + '/locale-contrib',
66     PROJECT_ROOT + '/locale',
67 )
68
69 INSTALLED_APPS = (
70     'accounts',
71
72     'cas_provider',
73     'fnpdjango',
74     'honeypot',
75     'south',
76     'django_libravatar',
77
78     'allauth',
79     'allauth.account',
80     'allauth.socialaccount',
81     'allauth.socialaccount.providers.facebook', 
82     'allauth.socialaccount.providers.openid',
83     #'allauth.socialaccount.providers.persona',
84
85     'django.contrib.auth',
86     'django.contrib.contenttypes',
87     'django.contrib.sessions',
88     'django.contrib.sites',
89     'django.contrib.admin',
90     'django.contrib.admindocs',
91     'django.contrib.staticfiles',
92
93 )
94
95 MIDDLEWARE_CLASSES = (
96     'django.middleware.common.CommonMiddleware',
97     'django.contrib.sessions.middleware.SessionMiddleware',
98     'django.middleware.csrf.CsrfViewMiddleware',
99     'honeypot.middleware.HoneypotMiddleware',
100     'django.contrib.auth.middleware.AuthenticationMiddleware',
101     'django.contrib.messages.middleware.MessageMiddleware'
102 )
103
104
105 TEMPLATE_CONTEXT_PROCESSORS = (
106     "django.contrib.auth.context_processors.auth",
107     "django.core.context_processors.debug",
108     "django.core.context_processors.i18n",
109     "django.core.context_processors.media",
110     "django.core.context_processors.static",
111     "django.core.context_processors.tz",
112     "django.contrib.messages.context_processors.messages",
113     "django.core.context_processors.request",
114     "allauth.account.context_processors.account",
115     "allauth.socialaccount.context_processors.socialaccount",
116     "cas.context_processors.settings",
117 )
118
119 AUTHENTICATION_BACKENDS = (
120     "django.contrib.auth.backends.ModelBackend",
121     "allauth.account.auth_backends.AuthenticationBackend",
122 )
123
124 # django-cas-provider settings
125 LOGIN_URL = '/cas/login/'
126 LOGOUT_URL = '/cas/logout/'
127 LOGIN_REDIRECT_URL = '/accounts/'
128 CAS_CUSTOM_ATTRIBUTES_CALLBACK = 'cas.utils.custom_attributes_callback'
129 SESSION_COOKIE_NAME = 'fnpcas'
130
131 REGISTRATION_OPEN = True
132 TEMPLATE_CONTEXT_SETTINGS = ('REGISTRATION_OPEN',)
133
134 ACCOUNT_EMAIL_VERIFICATION = None
135 SOCIALACCOUNT_AUTO_SIGNUP = False
136 SOCIALACCOUNT_AVATAR_SUPPORT = False
137 SOCIALACCOUNT_ADAPTER = 'cas.social.LooseSocialAccountAdapter'
138
139 SOCIALACCOUNT_PROVIDERS = {
140     'openid': {
141         'SERVERS': [
142             dict(id='google',
143                   name='Google',
144                   openid_url='https://www.google.com/accounts/o8/id')
145         ]
146     }
147 }
148
149
150 CONTRIB_LOCALE_APPS = [
151     'allauth',
152     'allauth.account',
153     'allauth.socialaccount',
154     'allauth.socialaccount.providers.facebook',
155     'allauth.socialaccount.providers.openid',
156 ]
157
158 # Import localsettings file, which may override settings defined here
159 try:
160     from localsettings import *
161 except ImportError:
162     pass