-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-example.py
62 lines (45 loc) · 1.45 KB
/
config-example.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
60
61
62
"""
This is an example of the config file!
You MUST make a copy of it named "config.py" in the same location and fill it
with the actual values. Since "config.py" holds all of your secrets it should
NEVER be committed to git.
"""
import os
class Config:
APP_NAME = 'Facebook II'
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
# All sorts of configuration variables can be set here
@staticmethod
def init_app(app):
"""
This method can be used to set up configuration-related things.
"""
pass
class DevelopmentConfig(Config):
DEBUG = True
DB_NAME = "myapp_dev.db"
@classmethod
def init_app(cls, app):
Config.init_app(app)
print('This is initalization for the development config.')
class TestingConfig(Config):
DEBUG = True
DB_NAME = "myapp_test.db"
@classmethod
def init_app(cls, app):
Config.init_app(app)
print('This is initalization for the testing config.')
class ProductionConfig(Config):
DEBUG = False
DB_NAME = "myapp_prod.db"
@classmethod
def init_app(cls, app):
Config.init_app(app)
print('This is initalization for the production config.')
# This dictionary maps different environment names to the actual config classes.
config = {
'default': DevelopmentConfig,
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig
}