-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
56 lines (40 loc) · 1.49 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
from os import environ
class Config(object):
"""Base configuration."""
DB_HOST = "bd_name"
DB_USER = "db_user"
DB_PASS = "db_pass"
DB_NAME = "db_name"
SECRET_KEY = "secret"
@staticmethod
def configure(app):
# Implement this method to do further configuration on your app.
pass
class ProductionConfig(Config):
"""Production configuration."""
DB_HOST = environ.get("DB_HOST", "localhost")
DB_USER = environ.get("DB_USER", "grupo41")
DB_PASS = environ.get("DB_PASS", "OWVmMmQ1YzNkMTlj")
DB_NAME = environ.get("DB_NAME", "grupo2")
SQLALCHEMY_DATABASE_URI = (
f"mysql+pymysql://{DB_USER}:{DB_PASS}@{DB_HOST}:3306/{DB_NAME}"
)
class DevelopmentConfig(Config):
"""Development configuration."""
DB_HOST = environ.get("DB_HOST", "localhost")
DB_USER = environ.get("DB_USER", "grupo41")
DB_PASS = environ.get("DB_PASS", "123456")
DB_NAME = environ.get("DB_NAME", "grupo2")
SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://{DB_USER}:{DB_PASS}@{DB_HOST}/{DB_NAME}"
class TestingConfig(Config):
"""Testing configuration."""
TESTING = True
DB_HOST = environ.get("DB_HOST", "localhost")
DB_USER = environ.get("DB_USER", "MY_DB_USER")
DB_PASS = environ.get("DB_PASS", "MY_DB_PASS")
DB_NAME = environ.get("DB_NAME", "MY_DB_NAME")
config = dict(
development=DevelopmentConfig, test=TestingConfig, production=ProductionConfig
)
## More information
# https://flask.palletsprojects.com/en/2.0.x/config/