1
Fork 0
mirror of https://github.com/Steffo99/estus.git synced 2024-11-21 23:24:18 +00:00

Improve exception handling during startup

This commit is contained in:
Steffo 2017-09-12 11:15:36 +02:00
parent 42cdd9a0f7
commit 8833a76262
2 changed files with 4 additions and 3 deletions

View file

@ -1,3 +1,4 @@
flask
flask_sqlalchemy
sqlalchemy
bcrypt

View file

@ -1,6 +1,7 @@
import os
from flask import Flask, session, url_for, redirect, request, render_template, abort
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.exc import OperationalError
import bcrypt
app = Flask(__name__)
@ -203,14 +204,13 @@ def page_dashboard():
enti = Ente.query.all()
conteggioservizi = dict()
goldfish = url_for("static", filename="goldfish.png")
terredicastello = url_for("static", filename="UTdClogo.png")
for ente in enti:
conteggioservizi[ente.nomeente] = Servizio.query.join(Ente).filter_by(eid=ente.eid).count()
conteggioutenti = dict()
for ente in enti:
conteggioutenti[ente.nomeente] = Impiegato.query.join(Servizio).join(Ente).filter_by(eid=ente.eid).count()
return render_template("dashboard.htm", type="main", user=session["username"],
conteggioutenti=conteggioutenti, conteggioservizi=conteggioservizi, goldfish=goldfish, terredicastello=terredicastello)
conteggioutenti=conteggioutenti, conteggioservizi=conteggioservizi, goldfish=goldfish)
@app.route('/ente_add', methods=['GET', 'POST'])
@ -550,6 +550,6 @@ if __name__ == "__main__":
secondary_dns="0.0.0.0")
db.session.add(retenulla)
db.session.commit()
except Exception:
except OperationalError:
db.session.rollback()
app.run(debug=True)