-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
72 lines (55 loc) · 1.92 KB
/
config.py
File metadata and controls
72 lines (55 loc) · 1.92 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
Configuration settings for the Headline API.
The definition of the different configuration settings is contained here:
- Development Configuration
- Production Configuration
- Testing Configuration
"""
import dotenv
dotenv.load()
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
USE_TOKEN_AUTH = True
DEBUG = False
SSLIFY_SUBDOMAINS = True
DEFAULT_PER_PAGE = 20
MAX_PER_PAGE = 100
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 TestingConfig(Config):
"""
The configuration settings for testing mode is defined here.
Attributes such as SQLALCHEMY_DATABASE_URI, TESTING are different for other
modes, so they are defined in a class called TestingConfig.
"""
USE_RATE_LIMITS = False
TESTING = True
SQLALCHEMY_DATABASE_URI = dotenv.get("TEST_DB")
SERVER_NAME = dotenv.get("SERVER_NAME")
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,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}