forked from bloodcurdle/xA-Scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
73 lines (48 loc) · 1.68 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
62
63
64
65
66
67
68
69
70
71
72
from settings import settings
import os
import sys
import hashlib
import datetime
import string
import random
random.seed()
if len(sys.argv) > 1 and "debug" in sys.argv:
SQLALCHEMY_ECHO = True
REFETCH_INTERVAL = datetime.timedelta(days=7*3)
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):
DATABASE_IP = settings['postgres']["address"]
DATABASE_DB_NAME = settings['postgres']["database"]
DATABASE_USER = settings['postgres']["username"]
DATABASE_PASS = settings['postgres']["password"]
SQLALCHEMY_DATABASE_URI = 'postgresql://{user}:{passwd}@{host}:5432/{database}'.format(user=DATABASE_USER, passwd=DATABASE_PASS, host=DATABASE_IP, database=DATABASE_DB_NAME)
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
CSRF_ENABLED = True
WTF_CSRF_ENABLED = True
# administrator list
ADMINS = ['[email protected]']
# slow database query threshold (in seconds)
DATABASE_QUERY_TIMEOUT = 0.5
SEND_FILE_MAX_AGE_DEFAULT = 60*60*12
# pagination
TAGS_PER_PAGE = 50
GENRES_PER_PAGE = 50
SERIES_PER_PAGE = 50
POSTS_PER_PAGE = 250
MAX_SEARCH_RESULTS = 50
FEED_ITEMS_PER_PAGE = 150
SQLALCHEMY_TRACK_MODIFICATIONS = False
RESOURCE_DIR = settings['webCtntPath']
# flask-assets
# ------------
ASSETS_DEST = 'rewrite/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)