quiz-the-word/config.py
Matthew Welch b4efbc8f3f Added user authentication for the admin site
Added error pages for 404 and 500 codes
Added site icon
2021-03-22 16:23:52 -07:00

32 lines
1.0 KiB
Python

from os import environ
from dotenv import load_dotenv
load_dotenv(".env")
class Config:
SECRET_KEY = environ.get("SECRET_KEY")
SECURITY_PASSWORD_SALT = environ.get("SECURITY_PASSWORD_SALT")
DB_USER = environ.get("DB_USER")
DB_PASSWORD = environ.get("DB_PASSWORD")
DB_HOST = environ.get("DB_HOST")
DB_PORT = environ.get("DB_PORT")
DB_NAME = environ.get("DB_NAME")
SECURITY_REGISTERABLE = True
class Production(Config):
FLASK_ENV = "production"
DEBUG = False
DB_SOCKET_DIR = environ.get("DB_SOCKET_DIR", "/cloudsql")
CLOUD_SQL_CONNECTION_NAME = environ.get("CLOUD_SQL_CONNECTION_NAME")
DB_URL = f"postgres+psycopg2://{Config.DB_USER}:{Config.DB_PASSWORD}@{Config.DB_HOST}:{Config.DB_PORT}/{Config.DB_NAME}?host={DB_SOCKET_DIR}/{CLOUD_SQL_CONNECTION_NAME}"
class Development(Config):
FLASK_ENV = "development"
DEBUG = True
TESTING = True
DB_URL = f"postgres+psycopg2://{Config.DB_USER}:{Config.DB_PASSWORD}@{Config.DB_HOST}:{Config.DB_PORT}/{Config.DB_NAME}"