I
I
Igor2019-11-03 13:42:48
Flask
Igor, 2019-11-03 13:42:48

When checking email and password does not go to the right page (FLASK PYTHON)?

I have forms.py in which there are 2 variables email and password , they have a built-in validator = (Data.Requiered email) and validator = (DataRequiered password)
then there is an html file in which form is created with methods="POST" action= "login", in which the fields for entering email and password and the LOGIN button are created, there is also the main start.py file for the web application, 3

@app.route 
1) @app.route("/")
return render_template("index.html")
2) @app.route("/login", methods = ["POST", "GET"])

here, respectively, checking the condition through
form1.validate_on_submit():
                                                                           render_template("main.html", form=form1)

3) well, @app.route("main.html") was created
with an empty page
And the bottom line is that when you enter an email and password, it doesn't redirect me to main.html,
but the page is simply updated and /login& is added to the url line.. ...........

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-11-06
@skipirich

I think in the block
somewhere at the end after processing the form data, you need to write
redirect and url_for, respectively, must be imported from flask
Actually, a strange route @app.route("main.html")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question