-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
48 lines (40 loc) · 1.43 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
import os
class Config:
'''
General configuration parent class
'''
SECRET_KEY = os.environ.get('SECRET_KEY')
UPLOADED_PHOTOS_DEST = 'app/static/img'
BASE_URL = 'https://trackapi.nutritionix.com/v2/natural/nutrients'
X_APP_ID = os.environ.get('X_APP_ID')
X_APP_KEY = os.environ.get('X_APP_KEY')
# Email configurations
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get("MAIL_USERNAME")
MAIL_PASSWORD = os.environ.get("MAIL_PASSWORD")
class ProdConfig(Config):
'''
Production configuration child class
Args:
Config: The parent configuration class with General configuration settings
'''
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL", "")
if SQLALCHEMY_DATABASE_URI.startswith("postgres://"):
SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("postgres://", "postgresql://", 1)
class TestConfig(Config):
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://peterken:pa55@localhost/project_week_test'
class DevConfig(Config):
'''
Development configuration child class
Args:
Config: The parent configuration class with General configuration settings
'''
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://peterken:pa55@localhost/project_week'
DEBUG = True
config_options = {
'development':DevConfig,
'production':ProdConfig,
'test': TestConfig
}