OIDC support.
[cas.git] / src / cas / settings.py
1 from os import path
2
3 PROJECT_ROOT = path.realpath(path.dirname(__file__))
4
5 DEBUG = True
6
7 ADMINS = [
8 ]
9
10 MANAGERS = ADMINS
11
12 DATABASES = {
13     'default': {
14         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
15         'NAME': path.join(PROJECT_ROOT, 'dev.sqlite'), # Or path to database file if using sqlite3.
16         'USER': '',                      # Not used with sqlite3.
17         'PASSWORD': '',                  # Not used with sqlite3.
18         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
19         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
20     }
21 }
22
23 # Local time zone for this installation. Choices can be found here:
24 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
25 # although not all choices may be available on all operating systems.
26 # If running in a Windows environment this must be set to the same as your
27 # system time zone.
28 TIME_ZONE = 'UTC'
29
30 # Language code for this installation. All choices can be found here:
31 # http://www.i18nguy.com/unicode/language-identifiers.html
32 LANGUAGE_CODE = 'pl'
33
34 SITE_ID = 1
35
36 # If you set this to False, Django will make some optimizations so as not
37 # to load the internationalization machinery.
38 USE_I18N = True
39
40 USE_TZ = 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 TEMPLATES = [
61     {
62         'BACKEND': 'django.template.backends.django.DjangoTemplates',
63         'APP_DIRS': True,
64         'DIRS': [
65             PROJECT_ROOT + '/templates',
66         ],
67         'OPTIONS': {
68             'context_processors': [
69                 "django.contrib.auth.context_processors.auth",
70                 "django.template.context_processors.debug",
71                 "django.template.context_processors.i18n",
72                 "django.template.context_processors.media",
73                 "django.template.context_processors.static",
74                 "django.template.context_processors.tz",
75                 "django.contrib.messages.context_processors.messages",
76                 "django.template.context_processors.request",
77             ],
78             'debug': DEBUG,
79         },
80     },
81 ]
82
83 LOCALE_PATHS = (
84     PROJECT_ROOT + '/locale',
85 )
86
87 INSTALLED_APPS = (
88     'accounts.apps.AccountsConfig',
89     'emails.apps.EmailsConfig',
90     'services.apps.ServicesConfig',
91     'ssh_keys.apps.SshKeysConfig',
92
93     'cas_provider',
94     'django_gravatar',
95     'oidc_provider',
96
97     'django.contrib.auth',
98     'django.contrib.contenttypes',
99     'django.contrib.messages',
100     'django.contrib.sessions',
101     'django.contrib.sites',
102     'django.contrib.admin',
103     'django.contrib.admindocs',
104     'django.contrib.staticfiles',
105 )
106
107 MIDDLEWARE = (
108     'django.contrib.sessions.middleware.SessionMiddleware',
109     'django.middleware.common.CommonMiddleware',
110     'django.middleware.csrf.CsrfViewMiddleware',
111     'django.contrib.auth.middleware.AuthenticationMiddleware',
112     'django.contrib.messages.middleware.MessageMiddleware',
113     'django.middleware.clickjacking.XFrameOptionsMiddleware',
114 )
115
116 # django-cas-provider settings
117 LOGIN_URL = '/cas/login/'
118 LOGOUT_URL = '/cas/logout/'
119 LOGIN_REDIRECT_URL = '/accounts/'
120 CAS_CUSTOM_ATTRIBUTES_CALLBACK = 'cas.utils.custom_attributes_callback'
121 SESSION_COOKIE_NAME = 'fnpcas'
122
123 GRAVATAR_DEFAULT_IMAGE = 'mm'
124 GRAVATAR_URL_PREFIX = 'https://www.gravatar.com/'
125
126 SITE_TITLE = 'Fundacja Nowoczesna Polska'
127
128 # Import localsettings file, which may override settings defined here
129 try:
130     from .localsettings import *
131 except ImportError:
132     pass