Files
website/run.py

33 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
from init_db import init_database
from app import app
if __name__ == "__main__":
# Lade .env-Datei explizit
env_path = Path(__file__).parent / ".env"
if env_path.exists():
print(f"Lade Umgebungsvariablen aus {env_path}")
load_dotenv(dotenv_path=env_path, override=True, force=True)
else:
print("Warnung: .env-Datei nicht gefunden!")
# Check if CSS file exists, build it if it doesn't
css_file = Path(__file__).parent / "static" / "css" / "main.css"
if not css_file.exists():
print("CSS file not found. Building with Tailwind...")
try:
from build_css import build_css
build_css()
except Exception as e:
print(f"Warning: Failed to build CSS: {e}")
print("You may need to run 'python build_css.py' manually.")
# Initialize the database first
init_database()
# Run the Flask application
app.run(debug=True, host='0.0.0.0', port=5000)