I'm trying to set up flash message to advise user that register was successful, for instance.
I followed this documentation and a few variants, but still it does not show.
I have also found this questions on SO, that suggests that the issue is with the SERVER_NAME configuration.
This should be very straight forward, so please check my code below.
from cs50 import SQL from flask import Flask, flash, redirect, render_template, request, session, url_for from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import default_exceptions from werkzeug.security import check_password_hash, generate_password_hash from helpers import apology, login_required, lookup, usd from inspect import getmembers from pprint import pprint # Configure application app = Flask(__name__) # this seems to be the only acceptable parameter, otherwise will 404 app.config['SERVER_NAME'] = 'ide50-myname.cs50.io:8080' @app.route("/register", methods=["GET", "POST"]) def register(): """ Register user """ # User reached route via POST (as by submitting a form via POST) if request.method == "POST": .... if not result: return apology("Username already taken", 403) if result: flash("Register succesful") # here I tried with plain redirect, without using url_for, with no luck # it will show the message if used with render_template, but that does not work well for the app return redirect(url_for('login')) # User reached route via GET (as by clicking a link or via redirect) else: return render_template("register.html")