05/06 Phase 2: fixed error 500 Internal Server Error 2

This commit is contained in:
2026-05-06 17:51:10 -04:00
parent d5847108db
commit 5b26836399
2 changed files with 16 additions and 6 deletions
+8 -3
View File
@@ -13,10 +13,15 @@ logger = logging.getLogger(__name__)
def create_admin_app(config_override=None):
import os as _os
# Resolve paths relative to this file to avoid CWD-dependent behaviour.
# app/admin/__init__.py → ../../templates = <project_root>/templates
_here = _os.path.dirname(_os.path.abspath(__file__))
_root = _os.path.normpath(_os.path.join(_here, "..", ".."))
flask_app = Flask(
__name__,
template_folder="../templates",
static_folder="../static/admin",
template_folder=_os.path.join(_root, "templates"),
static_folder=_os.path.join(_root, "static", "admin"),
static_url_path="/static",
)
@@ -87,4 +92,4 @@ def create_admin_app(config_override=None):
import app.models # noqa: F401
logger.info("Admin app created (env=%s)", flask_app.config.get("FLASK_ENV"))
return flask_app
return flask_app