feat(runserver): Selbst-supervidierenden Dev-Server, -D-Parameter funktional
- Supervisor-Modus im Dev-Betrieb: Der Server läuft als Subprozess und wird nach einem Abbruch neu gestartet. Der Werkzeug-Reloader beendet sich sonst komplett, wenn der App-Prozess beim Start crasht — als Hauptprozess des Containers würde damit der gesamte Dev-Container stoppen. Der Supervisor importiert die App nicht und überlebt so jeden Anwendungsfehler. - -D-Parameter ist jetzt funktional: Dev-Start direkt von der Befehlszeile ohne Devcontainer/Env-Variable. Debug-Entscheidung: -D ODER APP_DEBUG. - approot.py: init_app(debug) reicht die Debug-Entscheidung durch, damit Server-Typ und JS-Bundle-Auswahl (.js/.min.js) konsistent bleiben. wsgi.py (init_app() ohne Argument) unverändert. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
4e721e9a47
commit
24b492c5c1
2 files changed
+102
-21
No files matched your search
@@ -9,7 +9,7 @@ import os
|
||||
login_manager = LoginManager()
|
||||
|
||||
|
||||
def init_app():
|
||||
def init_app(debug: bool | None = None):
|
||||
app = Flask(__name__)
|
||||
|
||||
config: Configuration = Configuration("/usr/opt/pythonapp/App_Server/root/config.ini")
|
||||
@@ -20,7 +20,13 @@ def init_app():
|
||||
"auth": "sqlite:////usr/var/pythonappdb/auth.db",
|
||||
"appdb": "sqlite:////usr/var/pythonappdb/{}.db".format(_projektname)
|
||||
}
|
||||
app.config["DEBUG"] = os.environ.get("APP_DEBUG", "false").lower() in ("true", "1", "yes")
|
||||
# Dev-Modus: CLI-Parameter -D (via runserver) oder APP_DEBUG-Env.
|
||||
# debug=None = wie bisher allein über die Env-Variable entscheiden
|
||||
# (unverändertes Verhalten für wsgi.py).
|
||||
if debug is None:
|
||||
app.config["DEBUG"] = os.environ.get("APP_DEBUG", "false").lower() in ("true", "1", "yes")
|
||||
else:
|
||||
app.config["DEBUG"] = debug
|
||||
app.config["PROJEKTNAME"] = config.app_projectname
|
||||
app.config["APPID"] = config.app_appid
|
||||
app.config["APPVERSION"] = config.clientapp_version
|
||||
|
||||
Reference in new issue
Block a user