When I tried to use Flask-WTForms, I followed these steps:
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Emailclass EmailPasswordForm(Form):email = StringField('Email', validators=[DataRequired(), Email()])password = PasswordField('Password', validators=[DataRequired()])@app.route('/form',methods=['GET','POST'])
def email_form():form = EmailPasswordForm()return render_template('form.html',title = 'Sign In',form = form)
then I get TypeError: argument of type '_RequestGlobals' is not iterable.
Here is the form.html:
<html>
<head><title>Login Page</title>
</head>
<body><form action="{{ url_for("form") }}" method="POST"><input type="text" name="email" /><input type="password" name="password" />{{ form.csrf_token }}</form>
</body>