This commit is contained in:
2024-08-10 20:26:57 +02:00
commit 62f3ae7881
21 changed files with 189 additions and 0 deletions

0
app/config/__init__.py Normal file
View File

34
app/config/config.py Normal file
View File

@@ -0,0 +1,34 @@
class BaseConfig:
"""Base configuration."""
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'your-secret-key'
class DevelopmentConfig(BaseConfig):
"""Development configuration."""
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///development.db'
class TestingConfig(BaseConfig):
"""Testing configuration."""
DEBUG = True
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///testing.db'
class ProductionConfig(BaseConfig):
"""Production configuration."""
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///production.db'
def get_config_by_name(config_name):
""" Get config by name """
if config_name == 'development':
return DevelopmentConfig()
elif config_name == 'production':
return ProductionConfig()
elif config_name == 'testing':
return TestingConfig()
else:
return DevelopmentConfig()