forked from rtzll/flask-todolist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
48 lines (33 loc) · 1.11 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
# -*- coding: utf-8 -*-
import os
BASEDIR = os.path.abspath(os.path.dirname(__file__))
def create_sqlite_uri(db_name):
return 'sqlite:///' + os.path.join(BASEDIR, db_name)
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'secret key, just for testing'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = create_sqlite_uri('todolist-dev.db')
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = create_sqlite_uri('todolist-test.db')
WTF_CSRF_ENABLED = False
import logging
logging.basicConfig(
format='%(asctime)s:%(levelname)s:%(name)s:%(message)s'
)
logging.getLogger().setLevel(logging.DEBUG)
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = create_sqlite_uri('todolist.db')
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}