Solution
@app.route("/login", methods=['GET', 'POST'])
def login():
if current_user.is_authenticated:
return redirect(url_for('admin'))
else:
return redirect(url_for('home'))
@app.route("/admin")
def admin():
return render_template('admin_home.html')
@app.route("/home")
def home():
return render_template('home.html')