-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
41 lines (29 loc) · 996 Bytes
/
config.py
File metadata and controls
41 lines (29 loc) · 996 Bytes
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
"""Flask config class."""
from os.path import dirname, abspath, join
CWD = dirname(abspath(__file__))
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + join(CWD, 'cscourses.sqlite')
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'dfdQbTOExternjy5xmCNaA'
class ProdConfig(Config):
# The following are fictitious details for a MySQL server database! Included to illustrate the syntax.
DB_SERVER = '192.168.19.32'
SQLALCHEMY_DATABASE_URI = 'mysql://user@{}/foo'.format(DB_SERVER)
DEBUG = False
TESTING = False
class TestConfig(Config):
DEBUG = True
TESTING = True
# In memory database
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
# To allow forms to be submitted from the tests without the CSRF token
WTF_CSRF_ENABLED = False
class DevConfig(Config):
DEBUG = True
app_config = {
'development': DevConfig,
'production': ProdConfig,
'testing': TestConfig
}