Fix: add app.py for gunicorn, error handling in route
This commit is contained in:
+11
-6
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user