~libravatar/libravatar/master

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# Django settings for libravatar project.
import os

DEBUG = False
TEMPLATE_DEBUG = DEBUG

# LDAP debugging
#import logging
#logger = logging.getLogger('django_auth_ldap')
#logger.addHandler(logging.StreamHandler())
#logger.setLevel(logging.DEBUG)

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

SITE_NAME = 'libravatar.org'
SITE_URL = 'https://www.libravatar.org'
ALLOWED_HOSTS = SITE_URL.replace('https://', '').replace('http://', '')
CONTACT_US = 'https://wiki.libravatar.org/talk_to_us/'
SECURITY_URL = 'https://wiki.libravatar.org/security/'
SERVER_EMAIL = 'accounts@libravatar.org'
SUPPORT_EMAIL = 'support@libravatar.org'
DEV_EMAIL = 'dev@libravatar.org'
ADMIN_EMAIL = 'admin@libravatar.org'

DEFAULT_FROM_EMAIL = SERVER_EMAIL

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        "NAME": 'libravatar',
        "USER": 'djangouser',
        "PASSWORD": '',
        "HOST": '',
        "PORT": '',
        "OPTIONS": {'autocommit': True},
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'UTC'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

# pylint: disable=invalid-name
ugettext = lambda s: s
LANGUAGES = (
    ('ca', ugettext('Catalan')),
    ('cs', ugettext('Czech')),
    ('de', ugettext('German')),
    ('en', ugettext('English')),
    ('en_GB', ugettext('British English')),
    ('es', ugettext('Spanish')),
    ('eu', ugettext('Basque')),
    ('fr', ugettext('French')),
    ('it', ugettext('Italian')),
    ('ja', ugettext('Japanese')),
    ('nl', ugettext('Dutch')),
    ('pt_BR', ugettext('Brazilian Portuguese')),
    ('ru', ugettext('Russian')),
    ('sq', ugettext('Albanian')),
    ('tr', ugettext('Turkish')),
    ('uk', ugettext('Ukrainian')),
)

USE_I18N = True
USE_L10N = True
USE_TZ = True

# Absolute path to the directory that holds media.
# Example: "/home/libravatar/static/"
MEDIA_ROOT = '%s/static/' % BASE_DIR

# URL that handles the static files served from MEDIA_ROOT
MEDIA_URL = 'http://cdn.libravatar.org/'
# Enable this if you can serve your avatars over https
SECURE_MEDIA_URL = 'https://seccdn.libravatar.org/'
#SECURE_MEDIA_URL = None

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '+%&mv-4l5lrv^6nn9a-h4l1o2jqw_x^cf276mjz)$52aruy(g7'

PASSWORD_HASHERS = (
    'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
    'django.contrib.auth.hashers.BCryptPasswordHasher',
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
    'django.contrib.auth.hashers.SHA1PasswordHasher',
    'django.contrib.auth.hashers.MD5PasswordHasher',
    'django.contrib.auth.hashers.CryptPasswordHasher',
)

AUTHENTICATION_BACKENDS = (
    # Enable this to allow LDAP authentication. See INSTALL for more information.
    # 'django_auth_ldap.backend.LDAPBackend',
    'django_openid_auth.auth.OpenIDBackend',
    'django.contrib.auth.backends.ModelBackend',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'libravatar.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    '%s/libravatar/templates' % BASE_DIR,
)

TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.contrib.messages.context_processors.messages",
    "libravatar.context_processors.basepage"
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.messages',
    'django.contrib.sessions',
    'django_openid_auth',
    'libravatar.account',
    'libravatar.public',
    'libravatar.tools',
)

LOGIN_URL = '/account/login/'
LOGIN_REDIRECT_URL = '/account/profile/'  # Set to /account/profile_success/ for authenticating ldap users

# Path and URL for images uploaded by users
UPLOADED_FILES_ROOT = '%s/uploaded/' % BASE_DIR
UPLOADED_FILES_URL = '%s/uploaded/' % SITE_URL

# Path for images that were cropped and resized
READY_FILES_ROOT = '%s/ready/' % BASE_DIR

# Path and URL for images uploaded by users and ready to be served
USER_FILES_ROOT = '%s/user/' % BASE_DIR
USER_FILES_URL = '%s/user/' % SITE_URL

# Path and URL for user exports ready to be served
EXPORT_FILES_ROOT = '%s/export/' % BASE_DIR
EXPORT_FILES_URL = '%s/export/' % SITE_URL

# Path where avatars are stored
AVATAR_ROOT = '%s/avatar/' % BASE_DIR

# URL where avatars are served
AVATAR_URL = '%s/avatar/' % MEDIA_URL
SECURE_AVATAR_URL = None
if SECURE_MEDIA_URL:
    SECURE_AVATAR_URL = '%s/avatar/' % SECURE_MEDIA_URL

AVATAR_DEFAULT_SIZE = 80
AVATAR_MIN_SIZE = 1
AVATAR_MAX_SIZE = 512

# Mahara uses 20, 40 and 50
# Koha uses 40 and 80
# Ikiwiki uses 80
AVATAR_PREGENERATED_SIZES = [20, 30, 32, 40, 50, 60, 64, 80, 128, 140, 150, 312]

# The maximum number of unconfirmed email addresses per profile
MAX_NUM_UNCONFIRMED_EMAILS = 10

# The maximum number of photos per profile
MAX_NUM_PHOTOS = 4

# Maximum file size for each photo
MAX_PHOTO_SIZE = 10485760  # in bytes
FILE_UPLOAD_MAX_MEMORY_SIZE = MAX_PHOTO_SIZE

# Quality can be from 1 to 95
JPEG_QUALITY = 85

DEFAULT_PHOTO = '/img/nobody.png'
LIBRAVATAR_VERSION = '0.1'

GEARMAN_SERVERS = ['localhost']
GEARMAN_WORKER_LOGFILE = '/var/log/libravatar/workers.log'

# Time it takes (in seconds) for an avatar to be available
# on all mirrors
CDN_SYNC_DELAY = 30 * 60

# Session settings
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_SECURE = True

# LDAP Authentication
#import ldap
#AUTH_LDAP_GLOBAL_OPTIONS = {
#    ldap.OPT_PROTOCOL_VERSION: 3,
#    ldap.OPT_DEBUG_LEVEL: 7,
#    ldap.OPT_X_TLS_REQUIRE_CERT: False,
#}
AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com:389/"
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=StaffGroup,dc=example,dc=com"
AUTH_LDAP_USER_ATTR_MAP = {
    'first_name': 'givenName',
    'last_name': 'sn',
    'email': 'mail',
}
AUTH_LDAP_USER_PHOTO = 'jpegPhoto'

# To prevent sign-up, for instance on an intranet relying on external authentication, set this to true:
DISABLE_SIGNUP = False

# To restrict email addresses to a given domain, enter it here
REQUIRED_DOMAIN = ''

OPENID_CREATE_USERS = True
# Modify temporarily the session serializer because the json serializer in
# Django 1.6 can't serialize openid.yadis.manager.YadisServiceManager objects
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'

CACERTS = '/etc/ssl/certs/ca-certificates.crt'