Unverified Commit 6a0fbd8d authored by Dorian Johnson's avatar Dorian Johnson Committed by GitHub

chore: print human-readable error if index.html isn't found (#788)

Signed-off-by: 's avatarDorian Johnson <2020@dorianj.net>
parent a8c9e7ab
...@@ -2,11 +2,15 @@ ...@@ -2,11 +2,15 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
from typing import Any, Tuple from typing import Any, Tuple
import logging
from flask import Flask, render_template from flask import Flask, render_template
import jinja2
import os import os
ENVIRONMENT = os.getenv('APPLICATION_ENV', 'development') ENVIRONMENT = os.getenv('APPLICATION_ENV', 'development')
LOGGER = logging.getLogger(__name__)
def init_routes(app: Flask) -> None: def init_routes(app: Flask) -> None:
...@@ -16,7 +20,11 @@ def init_routes(app: Flask) -> None: ...@@ -16,7 +20,11 @@ def init_routes(app: Flask) -> None:
def index(path: str) -> Any: def index(path: str) -> Any:
return render_template("index.html", env=ENVIRONMENT) # pragma: no cover try:
return render_template("index.html", env=ENVIRONMENT) # pragma: no cover
except jinja2.exceptions.TemplateNotFound as e:
LOGGER.error("index.html template not found, have you built the front-end JS (npm run build in static/?")
raise e
def healthcheck() -> Tuple[str, int]: def healthcheck() -> Tuple[str, int]:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment