diff --git a/app.py b/app.py new file mode 100644 index 0000000..bc73234 --- /dev/null +++ b/app.py @@ -0,0 +1,4 @@ +"""Точка входа для gunicorn — app:app.""" +from app import create_app + +app = create_app() diff --git a/app/routes/main.py b/app/routes/main.py index ea1859d..d2fe989 100644 --- a/app/routes/main.py +++ b/app/routes/main.py @@ -10,9 +10,14 @@ bp = Blueprint("main", __name__) @bp.route("/") def index(): - client = HttpClient( - current_app.config["NUBES_API_ENDPOINT"], - current_app.config["NUBES_API_TOKEN"], - ) - org = get_organization(client) - return render_template("index.html", organization=org) + org = None + error = None + try: + client = HttpClient( + current_app.config["NUBES_API_ENDPOINT"], + current_app.config["NUBES_API_TOKEN"], + ) + org = get_organization(client) + except Exception as e: + error = str(e) + return render_template("index.html", organization=org, error=error) diff --git a/app/templates/index.html b/app/templates/index.html index a0b490f..f570db2 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -35,7 +35,7 @@ {% else %}
Организация не найдена. Проверьте токен и стенд.
+{% if error %}Ошибка: {{ error }}{% else %}Организация не найдена.{% endif %}