psycopg2n commit crashes on flaskredirect code example Example: how to redirect in flask to the same page return redirect(request.referrer)