Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a9a8a36cb9
|
|||
845e4ec673
|
|||
d82770158c
|
@ -19,8 +19,6 @@ app.config.update({
|
||||
})
|
||||
|
||||
oidc = OpenIDConnect(app)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
def calculate_nutrition(food, weight):
|
||||
@ -109,7 +107,7 @@ def convert_decimal(value):
|
||||
@app.route('/add_nutrition', methods=['POST'])
|
||||
@oidc.accept_token(['openid'])
|
||||
def add_nutrition():
|
||||
logger.info("add_nutrition")
|
||||
app.logger.info("add_nutrition")
|
||||
|
||||
food = request.form.get('food')
|
||||
kcal = convert_decimal(request.form.get('kcal'))
|
||||
@ -129,6 +127,7 @@ def add_nutrition():
|
||||
|
||||
return redirect(url_for('nutrition'))
|
||||
except Exception as e:
|
||||
app.logger.warn(f"error in add_nutrition: {e}")
|
||||
return jsonify({"error": str(e)}), 500
|
||||
finally:
|
||||
if conn:
|
||||
@ -138,7 +137,6 @@ def add_nutrition():
|
||||
@app.route('/nutrition')
|
||||
@oidc.require_login
|
||||
def nutrition():
|
||||
logger.info("nutrition")
|
||||
return render_template('nutrition.html')
|
||||
|
||||
@app.route('/get_token')
|
||||
@ -177,7 +175,7 @@ def get_database_entries():
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
app = ProxyFix(app, x_for=1, x_host=1)
|
||||
exposed_app = ProxyFix(app, x_for=1, x_host=1)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user