"feat: Added debug server and related components for improved development experience"
This commit is contained in:
37
backend/wsgi.py
Normal file
37
backend/wsgi.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
WSGI-Einstiegspunkt für die MYP Flask-Anwendung.
|
||||
Verwendet für den Produktionsbetrieb mit WSGI-Servern wie Gunicorn.
|
||||
"""
|
||||
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Lade Umgebungsvariablen
|
||||
load_dotenv()
|
||||
|
||||
from app import create_app
|
||||
|
||||
# Erstelle Anwendungsinstanz für Produktionsbetrieb
|
||||
flask_env = os.environ.get('FLASK_ENV', 'production')
|
||||
application = create_app(flask_env)
|
||||
|
||||
# Initialisierung für WSGI-Server
|
||||
with application.app_context():
|
||||
from app import init_db, init_printers, setup_frontend_v2
|
||||
import json
|
||||
|
||||
# Datenbank initialisieren
|
||||
init_db()
|
||||
|
||||
# Drucker initialisieren, falls konfiguriert
|
||||
printers_config = json.loads(application.config.get('PRINTERS', '{}'))
|
||||
if printers_config:
|
||||
init_printers()
|
||||
|
||||
# Frontend v2 Setup
|
||||
setup_frontend_v2()
|
||||
|
||||
application.logger.info(f'MYP Backend gestartet in {flask_env} Modus')
|
||||
|
||||
if __name__ == "__main__":
|
||||
application.run()
|
Reference in New Issue
Block a user