Files
bloodpressure/app/config.py
2026-03-09 21:34:26 +11:00

38 lines
1.2 KiB
Python

import os
from datetime import timedelta
class Config:
"""Base configuration."""
SECRET_KEY = os.environ.get('SECRET_KEY', '234234sdfsdfsdfsdf345345')
SQLALCHEMY_TRACK_MODIFICATIONS = False
# Session and Remember Me configurations to keep user logged in almost indefinitely (10 years)
PERMANENT_SESSION_LIFETIME = timedelta(days=3650)
REMEMBER_COOKIE_DURATION = timedelta(days=3650)
class DevelopmentConfig(Config):
"""Development configuration."""
DEBUG = True
uri = os.environ.get('DATABASE_URL', 'postgres://postgres:59fff56880e1bbb42e753d2a82ac21b6@peterstockings.com:15389/bloodpressure_db')
if uri and uri.startswith("postgres://"):
uri = uri.replace("postgres://", "postgresql://", 1)
SQLALCHEMY_DATABASE_URI = uri
class ProductionConfig(Config):
"""Production configuration."""
DEBUG = False
uri = os.environ.get('DATABASE_URL')
if uri and uri.startswith("postgres://"):
uri = uri.replace("postgres://", "postgresql://", 1)
SQLALCHEMY_DATABASE_URI = uri
class TestingConfig(Config):
"""Testing configuration."""
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'