-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
59 lines (49 loc) · 1.37 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
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""
config.py
Holds configuration for different development environments.
"""
# Standard imports
import os
# Base class configuration
class BaseConfig:
"""
Base settings. Holds default settings
for all environments.
"""
# Environment setup
DEBUG = False
TESTING = False
DB_SERVER = "localhost"
# Production configuration
class ProductionConfig(BaseConfig):
"""
Production settings. Holds additional settings
for production environment.
"""
DB_URI = os.getenv("DATABASE_URL")
SQLALCHEMY_DATABASE_URI = DB_URI
SQLALCHEMY_TRACK_MODIFICATIONS = True
class TestConfig(BaseConfig):
"""
Test settings. Holds additional settings for
test environment.
"""
DEBUG = True
# Development configuration
class DevelopmentConfig(BaseConfig):
"""
Development settings. Holds additional settings
for development environment.
"""
DEBUG = True
# Database setup
SECRET_KEY = os.getenv("SECRET_KEY")
DB_USERNAME = os.getenv("DB_USERNAME")
DB_PASSWORD = os.getenv("DB_PASSWORD")
DB_HOST = os.getenv("DB_HOST")
DATABASE_NAME = os.getenv("DATABASE_NAME")
DB_URI = f"postgresql+psycopg2://{DB_USERNAME}:{DB_PASSWORD}@{DB_HOST}/{DATABASE_NAME}"
SQLALCHEMY_DATABASE_URI = DB_URI
SQLALCHEMY_TRACK_MODIFICATIONS = True