-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
59 lines (41 loc) · 1.45 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
49
50
51
52
53
54
55
56
57
58
59
"""
Configuration settings for the ToDo List Application.
The definition of the different configuration settings is contained here:
- Development Configuration
- Production Configuration
"""
import os
import dotenv
dotenv.load()
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
"""
The definition of the global configuration is defined here.
Attributes such as SECRET_KEY are the same no matter the platform used.
"""
SECRET_KEY = dotenv.get("SECRET_KEY")
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = False
class DevelopmentConfig(Config):
"""
The configuration settings for development mode is defined here.
Attributes such as SQLALCHEMY_DATABASE_URI, DEBUG are different for other
modes, so they are defined in a class called DevelopmentConfig.
"""
SQLALCHEMY_DATABASE_URI = dotenv.get("DATABASE_URL")
SQLALCHEMY_TRACK_MODIFICATIONS = True
DEBUG = True
class ProductionConfig(Config):
"""
The configuration settings for production mode is defined here.
Attributes such as SQLALCHEMY_DATABASE_URI, DEBUG are different for other
modes, so they are defined in a class called ProductionConfig.
"""
SQLALCHEMY_DATABASE_URI = dotenv.get("DATABASE_URL")
# Object containing the different configuration classes.
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}