title: Issue with csrf_token while using Flask and WTForms
body: <p>I'm trying to set up a basic "Contact" form for my website, which will basically take in values and then put them into a CSV file. The issue I'm having is that the entries cannot be validated cause they're missing a csrf_token?</p>
  
  <p>Here's the relevant code from my app.py:</p>
  
  <pre><code>@app.route('/contact_end', methods=['POST'])
  def handle_contact():
      form = ContactForm()
      print(form.name.data)
      if form.validate_on_submit():
          print("yup")
          with open('data/messages.csv', 'a') as f:
              print("oh shit")
              writer = csv.writer(f)
              writer.writerow([form.name.data, form.email.data, form.message.data])
              print("waddup")
  
          return redirect(url_for('contact_handler.html'), name=form.name.data)
      print(form.errors)
      return render_template('contact.html', form=form)
  </code></pre>
  
  <p>It skips over the if statement as it never ends out printing the "yup", and instead it prints out the error:</p>
  
  <blockquote>
    <p>{'csrf_token': ['The CSRF token is missing.']}</p>
  </blockquote>
  
  <p>The template that this connects to is:</p>
  
  <pre><code>{% extends "base_template.html" %}
      {% block title %}Contact us {% endblock %}
      {% block content %}
      &lt;p&gt;Feel free to use the contact form below to send us any questions you might have.&lt;/p&gt;&lt;/br&gt;
          &lt;form action="/contact_end" method="post"&gt;
              {{ form.csrf_token }}
              &lt;label&gt;Your Name &lt;input type="text" name="name"/&gt;&lt;/label&gt;&lt;/br&gt;
              &lt;label&gt;Your Email &lt;input type="text" name="email"/&gt;&lt;/label&gt;&lt;/br&gt;
              &lt;label&gt;Your Name &lt;textarea name="message"&gt;&lt;/textarea&gt;&lt;/label&gt;&lt;/br&gt;
              &lt;button type="submit"&gt;Send&lt;/button&gt;
              &lt;button type="reset"&gt;Clear&lt;/button&gt;
          &lt;/form&gt;
      {% endblock %}
  </code></pre>
  
  <p>I've tried messing with form.csrf_token and .hidden_tags(), but with no success.</p>
  
  <p>As well, this is the initial part of app.py that brings you to the page in the first place, the one above is the endpoint for the form:</p>
  
  <pre><code>@app.route('/contact')
  def contact():
      return render_template('contact.html', form=form)
  </code></pre>
  
  <p>Finally, here's my ContactForm class:</p>
  
  <pre><code>class ContactForm(FlaskForm):
      print("yep")
      name = StringField('Name', validators=[InputRequired()])
      email = EmailField('Email', validators=[InputRequired(), Email()])
      message = TextAreaField('Message', validators=[InputRequired()])
  </code></pre>
  
  <p>I've made sure to set my secret key, as well. Anyone have any idea why this isn't working? Many thanks.</p>