system-pri/backend/app/config.py

45 lines
981 B
Python

import os
from pathlib import Path
class Config:
TESTING = False
DB_SERVER = "localhost"
BASE_DIR = Path(__file__).resolve().parent.parent
SRC_DIR = BASE_DIR / "app"
EXCLUDED_DIRS = ["__pycache__", "commands"]
TIMEZONE = 'Europe/Warsaw'
ENABLE_CORS = os.environ.get('ENABLE_CORS') or False
ALLOWED_EXTENSIONS = {'csv'}
MAX_CONTENT_LENGTH = 10 * 1024 * 1024 # 10 MB
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = f'sqlite:///{BASE_DIR / "db.sqlite"}'
LIMIT_STUDENTS_PER_GROUP = 5
LIMIT_PERSONS_PER_COMMITTEE = 4
DESCRIPTION = 'System PRI'
OPENAPI_VERSION = '3.0.2'
class ProductionConfig(Config):
DB_SERVER = "0.0.0.0"
class DevelopmentConfig(Config):
DEBUG = True
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
config = {
"development": DevelopmentConfig,
"production": ProductionConfig,
"testing": TestingConfig,
}