-
Notifications
You must be signed in to change notification settings - Fork 8
/
config.py
62 lines (37 loc) · 1.18 KB
/
config.py
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
import os
import sys
import hashlib
import datetime
import string
import random
random.seed()
from settings import SQLALCHEMY_DATABASE_URI as C_SQLALCHEMY_DATABASE_URI
if len(sys.argv) > 1 and "debug" in sys.argv:
SQLALCHEMY_ECHO = True
basedir = os.path.abspath(os.path.dirname(__file__))
def get_random(chars):
rand = [random.choice(string.ascii_letters) for x in range(chars)]
rand = "".join(rand)
return rand
class BaseConfig(object):
SQLALCHEMY_DATABASE_URI = C_SQLALCHEMY_DATABASE_URI
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
CSRF_ENABLED = True
WTF_CSRF_ENABLED = True
# administrator list
ADMINS = ['you@example.com']
# slow database query threshold (in seconds)
DATABASE_QUERY_TIMEOUT = 0.5
SEND_FILE_MAX_AGE_DEFAULT = 60*60*12
# pagination
POSTS_PER_PAGE = 250
SQLALCHEMY_TRACK_MODIFICATIONS = False
# flask-assets
# ------------
ASSETS_DEST = 'xascraper/static'
# The WTF protection doesn't have to persist across
# execution sessions, since that'll break any
# active sessions anyways. Therefore, just generate
# them randomly at each start.
SECRET_KEY = get_random(20)
WTF_CSRF_SECRET_KEY = get_random(20)