-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
36 lines (25 loc) · 931 Bytes
/
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
import os
basedir = os.path.abspath(os.path.dirname(__file__))
def of_env():
env = os.getenv('FLASK_ENV') or 'testing'
if env.lower().startswith('production'):
return ProductionConfig
elif env.lower().startswith('development'):
return DevelopmentConfig
else:
return TestingConfig
class Config(object):
ADMIN_PWD = os.environ.get('ADMIN_PWD') or '123456'
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'app.db')
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_TRACK_MODIFICATIONS = False
extend_existing = True
DEBUG = False
TESTING = False
class ProductionConfig(Config):
SECRET_KEY = os.urandom(16)
class DevelopmentConfig(Config):
DEBUG = True
class TestingConfig(Config):
TESTING = True