def load_user(username): user = User(mongo, username) if user.is_authenticated(): return user return None @app.route("/logout", methods=["GET"]) def logout(): logout_user() form = LoginForm() return render_template("login.html", form=form) @app.route("/login", methods=["GET", "POST"]) def login(): next = request.args.get('next') form = LoginForm() if form.validate_on_submit(): user = User(mongo, form.data['username'], password=form.data['password']) if not user.is_authenticated(): flash('Brugernavn eller password forkert') return render_template('login.html', form=form, next=next) #return redirect('/login') else: res = login_user(user) return redirect('/') return render_template("login.html", form=form) if __name__ == '__main__': app.run(host='0.0.0.0', debug=True) #app.run(host='0.0.0.0', debug=False)
from invoice import app app.run(debug=True)
from invoice import app if __name__ == "__main__": app.run(debug=True)