| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- """Configuration settings for the Flask application."""
- import os
- basedir = os.path.abspath(os.path.dirname(__file__))
- class Config:
- """Base configuration."""
- SECRET_KEY = os.environ.get('SECRET_KEY', 'dev-secret-key')
- SQLALCHEMY_TRACK_MODIFICATIONS = False
-
- # API settings
- RESTX_MASK_SWAGGER = False
- RESTX_ERROR_404_HELP = False
-
- # JWT settings
- JWT_SECRET_KEY = os.environ.get('JWT_SECRET_KEY', 'jwt-dev-secret-key')
- JWT_EXPIRATION_DAYS = 30
- JWT_ALGORITHM = 'HS256'
- class DevelopmentConfig(Config):
- """Development configuration."""
- DEBUG = True
- SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
- 'sqlite:///' + os.path.join(basedir, '..', 'dev.db')
- class TestingConfig(Config):
- """Testing configuration with SQLite."""
- TESTING = True
- SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
- class ProductionConfig(Config):
- """Production configuration with PostgreSQL."""
- DEBUG = False
- SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
- 'postgresql://localhost/work_statistics'
- config = {
- 'default': DevelopmentConfig,
- 'development': DevelopmentConfig,
- 'testing': TestingConfig,
- 'production': ProductionConfig
- }
|