-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
78 lines (60 loc) · 2.01 KB
/
settings.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
73
74
75
76
77
78
import os
import inspect
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
class Config(object):
ADMINS = ['']
APPNAME = 'Flask-Boilerplate'
SUPPORT_EMAIL = ''
VERSION = '1.0.0'
if os.environ.get('SECRET_KEY'):
SECRET_KEY = os.environ.get('SECRET_KEY')
else:
SECRET_KEY = 'SECRET_KEY_ENV_VAR_NOT_SET'
print('SECRET KEY ENV VAR NOT SET! SHOULD NOT SEE IN PRODUCTION')
HOST = 'localhost'
PORT = int(os.environ.get('PORT', 5000))
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_NATIVE_UNICODE = True
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
STATIC_FOLDER = os.path.dirname(os.path.abspath(inspect.stack()[0][1])) + '/main/static'
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'database.db')
SQLALCHEMY_POOL_RECYCLE = 240
SQLALCHEMY_POOL_TIMEOUT = 60
SQLALCHEMY_POOL_SIZE = 200
SQLALCHEMY_MAX_OVERFLOW = 0
DATABINDS = {}
class UnitTestConfig(Config):
DEBUG = True
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'database.db')
SQLALCHEMY_POOL_RECYCLE = 240
SQLALCHEMY_POOL_TIMEOUT = 60
SQLALCHEMY_POOL_SIZE = 200
SQLALCHEMY_MAX_OVERFLOW = 0
DATABINDS = {}
class TestingConfig(Config):
DEBUG = False
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'database.db')
SQLALCHEMY_POOL_RECYCLE = 240
SQLALCHEMY_POOL_TIMEOUT = 60
SQLALCHEMY_POOL_SIZE = 200
SQLALCHEMY_MAX_OVERFLOW = 0
DATABINDS = {}
class ProductionConfig(Config):
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'database.db')
SQLALCHEMY_POOL_RECYCLE = 240
SQLALCHEMY_POOL_TIMEOUT = 60
SQLALCHEMY_POOL_SIZE = 200
SQLALCHEMY_MAX_OVERFLOW = 0
DATABINDS = {}
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'unittest': UnitTestConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}