title: Can anyone tell me why i am getting "NameError: name 'validators' is not defined" in flask? As i am new to flask
body: <p>I am using Wt forms in flask i have installed the wtf module and use it to create form but when i try to run the application it is showing that Validators are not defined even though i have imported it correctly.
  Please check and correct what i am doing wrong with my piece of code.
  Thanks</p>
  
  <p>I have checked multiple article over the web but nothing solved my problem</p>
  
  <pre><code>from flask_wtf import FlaskForm
  from wtforms import StringField,PasswordField,SubmitField,BooleanField
  from wtforms.validators import DataRequired, Length, Email, EqualTo
  
  class RegistrationForm(FlaskForm):
  username = StringField('Username', validators[DataRequired(),Length(min=2, max=20)])
  email = StringField('Email', validators[DataRequired(), Email()])
  password = PasswordField('Password', validators[DataRequired()])
  confirm_password = PasswordField('Confirm Password', validators[DataRequired(), EqualTo('password')])
  submit =  SubmitField('Sign Up')
  
  class LoginForm(FlaskForm):
  email = StringField('Email', validators[DataRequired(), Email()])
  password = PasswordField('Password', validators[DataRequired()])
  remember = BooleanField('Remember Me')
  submit =  SubmitField('Login')
  </code></pre>
  
  <p>The traceback:</p>
  
  <pre><code>Traceback (most recent call last):
  File "app.py", line 2, in &lt;module&gt;
  from forms import RegistrationForm, LoginForm
  File "/Users/bennykhatri/Practice/Flask/Corey/forms.py", line 5, in    &lt;module&gt;
  class RegistrationForm(FlaskForm):
  File "/Users/bennykhatri/Practice/Flask/Corey/forms.py", line 6, in  RegistrationForm
  username = StringField('Username', validators[DataRequired(),  Length(min=2, max=20)])
  NameError: name 'validators' is not defined
  </code></pre>