-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
69 lines (55 loc) · 1.92 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
60
61
62
63
64
65
66
67
68
69
import os
from dotenv import load_dotenv
load_dotenv()
class Config:
"""
Class for app configuration
"""
# WTForms configurations
SECRET_KEY = os.getenv("SECRET_KEY")
# Set location for Flask Uploads
UPLOADED_PHOTOS_DEST = "app/static/images/profile_pics"
# API Key configurations
QUOTE_URL = "http://quotes.stormconsultancy.co.uk/random.json"
# Mail configurations
MAIL_SERVER = os.getenv("MAIL_SERVER")
MAIL_PORT = os.getenv("MAIL_PORT")
MAIL_USE_TLS = os.getenv("MAIL_USE_TLS")
MAIL_USERNAME = os.getenv("MAIL_USERNAME")
MAIL_PASSWORD = os.getenv("MAIL_PASSWORD")
# SimpleMDE Configurations
SIMPLEMDE_JS_IIFE = True
SIMPLEMDE_USER_CDN = True
class DevConfig(Config):
"""
Class for development configurations. Child of class Config.
"""
DB_USERNAME = os.getenv("DB_USERNAME")
DB_PASSWORD = os.getenv("DB_PASSWORD")
DB_NAME = os.getenv("DB_NAME")
DB_HOST = os.getenv("DB_HOST")
DB_CONNECTOR = os.getenv("DB_CONNECTOR")
DB_ADAPTER = os.getenv("DB_ADAPTER")
SQLALCHEMY_DATABASE_URI = f"{DB_CONNECTOR}+{DB_ADAPTER}://{DB_USERNAME}:{DB_PASSWORD}@{DB_HOST}/{DB_NAME}"
DEBUG = os.getenv("APPLICATION_DEBUG") == "True"
class TestConfig(Config):
"""
Class for testing configurations. Child of class Config.
"""
DB_USERNAME = os.getenv("DB_USERNAME")
DB_PASSWORD = os.getenv("DB_PASSWORD")
DB_NAME = os.getenv("DB_NAME")
DB_HOST = os.getenv("DB_HOST")
DB_CONNECTOR = os.getenv("DB_CONNECTOR")
DB_ADAPTER = os.getenv("DB_ADAPTER")
SQLALCHEMY_DATABASE_URI = f"{DB_CONNECTOR}+{DB_ADAPTER}://{DB_USERNAME}:{DB_PASSWORD}@{DB_HOST}/{DB_NAME}"
class ProdConfig(Config):
"""
Class for production configurations. Child of class Config.
"""
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL")
config_options = {
"development": DevConfig,
"test": TestConfig,
"production": ProdConfig
}