Files
TimeTracker/app/config/__init__.py
T
Dries Peeters b4486a627f fix: CI tests, code quality, and duplicate DB indexes
- Webhook models: remove duplicate index definitions so db.create_all()
  no longer raises 'index already exists' (columns already have index=True)
- ImportService: fix circular import by late-importing ClientService,
  ProjectService, TimeTrackingService in __init__
- reports: fix F823 by renaming unpack variable _ to _entry_count to avoid
  shadowing gettext _ in export_task_excel()
- Code quality: add .flake8 with extend-ignore so flake8 CI passes;
  simplify pyproject.toml isort config (drop unsupported options)
- Format: run black and isort on app/
- tests: restore minimal app fixture in test_import_export_models
2026-03-15 10:51:52 +01:00

55 lines
1.8 KiB
Python

"""
Configuration module for TimeTracker.
This module contains:
- Flask application configuration (Config, ProductionConfig, etc.)
- Analytics configuration for telemetry
"""
import os
# Import Flask configuration classes from parent config.py
# We need to import from the parent app module to avoid circular imports
import sys
# Import analytics configuration
from app.config.analytics_defaults import get_analytics_config, has_analytics_configured
# Import Flask Config classes from the config.py file in parent directory
# The config.py was shadowed when we created this config/ package
# So we need to import it properly
try:
# Try to import from a renamed file if it exists
from app.flask_config import Config, DevelopmentConfig, ProductionConfig, TestingConfig
except ImportError:
# If the file wasn't renamed, we need to import it differently
# Add parent to path temporarily to import the shadowed config.py
import importlib.util
config_py_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.py")
if os.path.exists(config_py_path):
spec = importlib.util.spec_from_file_location("flask_config_module", config_py_path)
flask_config = importlib.util.module_from_spec(spec)
spec.loader.exec_module(flask_config)
Config = flask_config.Config
ProductionConfig = flask_config.ProductionConfig
DevelopmentConfig = flask_config.DevelopmentConfig
TestingConfig = flask_config.TestingConfig
else:
# Fallback - create minimal config
class Config:
pass
ProductionConfig = Config
DevelopmentConfig = Config
TestingConfig = Config
__all__ = [
"get_analytics_config",
"has_analytics_configured",
"Config",
"ProductionConfig",
"DevelopmentConfig",
"TestingConfig",
]