38 lines
1.1 KiB
Batchfile
38 lines
1.1 KiB
Batchfile
@echo off
|
|
REM MYP Backend - Produktions-Startskript für Windows
|
|
REM Startet die Flask-Anwendung mit Waitress für den Produktionsbetrieb
|
|
|
|
echo === MYP Backend - Produktionsstart ===
|
|
|
|
REM Konfiguration
|
|
if not defined WORKERS set WORKERS=4
|
|
if not defined BIND_ADDRESS set BIND_ADDRESS=0.0.0.0
|
|
if not defined PORT set PORT=5000
|
|
if not defined THREADS set THREADS=6
|
|
|
|
REM Umgebungsvariablen
|
|
set FLASK_ENV=production
|
|
set PYTHONPATH=%PYTHONPATH%;%cd%
|
|
|
|
REM Log-Verzeichnis erstellen
|
|
if not exist logs mkdir logs
|
|
|
|
REM Prüfe, ob SECRET_KEY gesetzt ist
|
|
if not defined SECRET_KEY (
|
|
echo WARNUNG: SECRET_KEY ist nicht gesetzt. Verwende einen generierten Schlüssel.
|
|
for /f %%i in ('python -c "import secrets; print(secrets.token_hex(32))"') do set SECRET_KEY=%%i
|
|
)
|
|
|
|
REM Produktionsparameter ausgeben
|
|
echo Konfiguration:
|
|
echo - Host: %BIND_ADDRESS%
|
|
echo - Port: %PORT%
|
|
echo - Threads: %THREADS%
|
|
echo - Environment: %FLASK_ENV%
|
|
echo.
|
|
|
|
REM Waitress starten (besser für Windows als Gunicorn)
|
|
echo Starte Waitress-Server...
|
|
python -m waitress --host=%BIND_ADDRESS% --port=%PORT% --threads=%THREADS% --call wsgi:application
|
|
|
|
pause |