dcbc7765edba7cec95a442e5fdf8087c856f8167
[qcg-portal.git] / plgng / settings_common.py
1 """
2 Django settings for plgng project.
3
4 For more information on this file, see
5 https://docs.djangoproject.com/en/1.7/topics/settings/
6
7 For the full list of settings and their values, see
8 https://docs.djangoproject.com/en/1.7/ref/settings/
9 """
10
11 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
12 import os
13
14 from django.conf import global_settings
15 from django.contrib.messages import constants as messages
16
17 from local import *
18 from settings_logging import LOGGING
19
20 BASE_DIR = os.path.dirname(os.path.dirname(__file__))
21
22
23 # Application definition
24
25 INSTALLED_APPS = (
26     'grappelli',
27     'django.contrib.admin',
28     'django.contrib.auth',
29     'django.contrib.contenttypes',
30     'django.contrib.sessions',
31     'django.contrib.messages',
32     'django.contrib.staticfiles',
33     'django.contrib.webdesign',
34     'qcg',
35     'filex',
36     'django_openid_auth',
37     'bootstrap3',
38 )
39
40 MIDDLEWARE_CLASSES = (
41     'django.contrib.sessions.middleware.SessionMiddleware',
42     'django.middleware.common.CommonMiddleware',
43     'django.middleware.csrf.CsrfViewMiddleware',
44     'django.contrib.auth.middleware.AuthenticationMiddleware',
45     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
46     'django.contrib.messages.middleware.MessageMiddleware',
47     'django.middleware.clickjacking.XFrameOptionsMiddleware',
48 )
49
50 TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
51     'django.core.context_processors.request',
52 )
53
54 ROOT_URLCONF = 'plgng.urls'
55
56 WSGI_APPLICATION = 'plgng.wsgi.application'
57
58
59 # Internationalization
60 # https://docs.djangoproject.com/en/1.7/topics/i18n/
61
62 LANGUAGE_CODE = 'pl'
63
64 TIME_ZONE = 'Europe/Warsaw'
65
66 USE_I18N = True
67
68 USE_L10N = True
69
70 USE_TZ = True
71
72
73 CUSTOM_DATETIME_FORMAT = 'j b Y, H:i'
74
75
76 # Static files (CSS, JavaScript, Images)
77 # https://docs.djangoproject.com/en/1.7/howto/static-files/
78
79 STATIC_URL = '/static/'
80
81
82 # Authentication
83
84 AUTH_USER_MODEL = 'qcg.User'
85
86 AUTHENTICATION_BACKENDS = (
87     'django_openid_auth.auth.OpenIDBackend',
88     'django.contrib.auth.backends.ModelBackend',
89 )
90
91 LOGIN_URL = 'login'
92 LOGIN_REDIRECT_URL = '/jobs/'
93
94 # If set, always use this as the identity URL rather than asking the
95 # user.  This only makes sense if it is a server URL.
96 OPENID_SSO_SERVER_URL = 'https://openid.plgrid.pl/gateway'
97
98 # Should users be created when new OpenIDs are used to log in?
99 OPENID_CREATE_USERS = True
100
101 # Update user details from OpenID each time they log in
102 OPENID_UPDATE_DETAILS_FROM_SREG = True
103
104 # Login will fail if no 'nickname' (username), or if the nickname
105 # conflicts with an existing user with a different openid identity url
106 OPENID_STRICT_USERNAMES = True
107
108
109 SESSION_COOKIE_NAME = 'qcg_session'
110 SESSION_COOKIE_AGE = 60 * 60 * 24 * 6  # 6 days, length of user proxy from openid is 1 week
111 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
112
113
114 # 3-rd party settings
115
116 BOOTSTRAP3 = {
117     'horizontal_label_class': 'col-sm-3 col-md-4',
118     'horizontal_field_class': 'col-sm-9 col-md-6',
119     'set_placeholder': False,
120 }
121
122 # map message tags to bootstrap classes
123
124 MESSAGE_TAGS = {
125     messages.INFO: 'alert alert-info',
126     messages.SUCCESS: 'alert alert-success',
127     messages.WARNING: 'alert alert-warning',
128     messages.ERROR: 'alert alert-danger',
129 }
130
131
132 GRAPPELLI_ADMIN_TITLE = 'Portal QCG'