|
3 | 3 | import logging |
4 | 4 | import os |
5 | 5 | from pathlib import Path |
6 | | -from typing import Optional |
7 | | - |
8 | | -# Configure logging |
9 | | -logging.basicConfig( |
10 | | - level=logging.INFO, |
11 | | - format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", |
12 | | -) |
13 | | -logger = logging.getLogger(__name__) |
14 | | - |
15 | | - |
16 | | -def setup_environment() -> dict[str, str]: |
17 | | - """Load environment variables from .env file.""" |
18 | | - env_vars = {} |
19 | | - env_path = Path(".env") |
20 | | - |
21 | | - if env_path.exists(): |
22 | | - with env_path.open() as f: |
23 | | - for line in f: |
24 | | - line = line.strip() |
25 | | - if line and not line.startswith("#"): |
26 | | - key, value = line.split("=", 1) |
27 | | - env_vars[key.strip()] = value.strip() |
28 | | - |
29 | | - return env_vars |
| 6 | +from typing import Dict |
| 7 | + |
30 | 8 |
|
31 | 9 |
|
32 | | -def main() -> None: |
33 | | - """Main application entry point.""" |
34 | | - try: |
35 | | - # Load environment variables |
36 | | - env_vars = setup_environment() |
37 | | - app_name = env_vars.get("APP_NAME", "template-python") |
38 | | - env = env_vars.get("ENV", "development") |
39 | | - debug = env_vars.get("DEBUG", "false").lower() == "true" |
40 | 10 |
|
41 | | - # Configure logging level based on debug setting |
42 | | - if debug: |
43 | | - logging.getLogger().setLevel(logging.DEBUG) |
44 | | - logger.debug("Debug mode enabled") |
45 | 11 |
|
46 | | - logger.info(f"Starting {app_name} in {env} environment") |
47 | 12 |
|
48 | | - # Your application initialization code here |
49 | | - # For example: |
50 | | - # app = create_app() |
51 | | - # app.run() |
| 13 | +def main() -> None: |
| 14 | + """Main application entry point.""" |
| 15 | + try: |
| 16 | + print("Start app...") |
| 17 | + import src.modules.api |
52 | 18 |
|
53 | 19 | except Exception as e: |
54 | | - logger.error(f"Application failed to start: {e}", exc_info=True) |
| 20 | + print(f"Application failed to start: {e}", exc_info=True) |
55 | 21 | raise |
56 | 22 |
|
57 | 23 |
|
|
0 commit comments