-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
46 lines (33 loc) · 1.04 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
# coding=utf-8
import os
import tempfile
basedir = os.path.abspath(os.path.dirname(__file__))
tempdir = tempfile.gettempdir()
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'it is a secret'
SQLALCHEMY_TRACK_MODIFICATIONS = False
@staticmethod
def init_app(app):
pass
class DevConfig(Config):
DEBUG = True
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URI') \
or 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
class TestConfig(Config):
DEBUG = False
TESTING = True
SERVER_NAME = 'test.flaskr'
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URI') \
or 'sqlite:///' + os.path.join(tempdir, 'data-test.sqlite')
class ProdConfig(Config):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.environ.get('PROD_DATABASE_URI') \
or 'sqlite:///' + os.path.join(basedir, 'data-prod.sqlite')
config = {
'development': DevConfig,
'testing': TestConfig,
'production': ProdConfig,
'default': DevConfig,
}