-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsettings.py
More file actions
58 lines (44 loc) · 1.49 KB
/
settings.py
File metadata and controls
58 lines (44 loc) · 1.49 KB
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
"""
====================
learnpython.settings
====================
Default configuration for Learn Python site.
You could customize things by overwrite these or other settings of Flask and
other used extensions in ``settings_local`` module which should placed next to
current one.
"""
import os
DIRNAME = os.path.abspath(os.path.dirname(__file__))
env = os.environ.get
rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts))
# Debug settings
DEBUG = False
# Babel settings
BABEL_DEFAULT_LOCALE = 'ru'
BABEL_DEFAULT_TIMEZONE = 'Europe/Kiev'
# FlatPages settings
FLATPAGES_EXTENSION = '.yml'
FLATPAGES_HTML_RENDERER = 'learnpython.utils:restructuredtext_filter'
FLATPAGES_ROOT = rel('data')
# Mail settings
MAIL_FAIL_SILENTLY = False
MAIL_SERVER = env('MAILGUN_SMTP_SERVER', 'localhost')
MAIL_PORT = env('MAILGUN_SMTP_PORT', 25)
MAIL_USERNAME = env('MAILGUN_SMTP_LOGIN', '')
MAIL_PASSWORD = env('MAILGUN_SMTP_PASSWORD', '')
# WTForms settings
SECRET_KEY = env('SECRET_KEY', 'Z\xc7G\xaf\x15$\xc1O\x8d\xb0Bks\x9b\n\x9a')
# Project-related settings
ALLOW_SUBSCRIBERS = bool(int(env('ALLOW_SUBSCRIBERS', 1)))
# Import local settings if any
try:
from learnpython import settings_local
except ImportError:
pass
else:
for attr in dir(settings_local):
if attr.startswith('_'):
continue
locals()[attr] = getattr(settings_local, attr)