A Flask application server provides a simple (beautified) survey to the user. When the user clicks SUBMIT, Flask first checks to see if the user filled out all the fields. Flask then uses the Google reCAPTCHA service to make sure the user is not a Robot.

Before we begin, if you would like more detail on how Flask uses routes to generate the appropriate web pages for the end user, check out HOWTO-2. If you would like to see how Flask can beautify and validate the survey form using Bootstrap, check out HOWTO-3. You do not need the details, however, to run this demo.

This demo includes the following fun, easy steps:

Deploy a simple, usable web Application

Get reCAPTCHA Keys

Update web Application to require reCAPTCHA

Test the new reCAPTCHA service

Step 1: Deploy a simple, usable web Application

We deploy the following baseline application, which uses "quick_form" to render our survey's web page. This application doesn't do anything except print "success," but you can easily extend it to persist data, for example, using an ORM. The simple baseline app uses the following Architecture:

If you navigate to your web page on port 5000, you will see the following form.

This application uses the quick_form method to generate a web page. Note that the application includes all sorts of goodies, such as CSFR avoidance, professional looking highlights and validation. Play around with the page to look at the different validation pop-ups and warnings.

Now that we have a working baseline application, let's get reCAPTCHA keys.

# Form ORMclassQuizForm(Form):essay_question=TextAreaField('Who do you think won the console wars of 1991, Sega Genesis or Super Nintendo? (2048 characters)',validators=[Required(),Length(max=2047)])email_addr=TextField('Enter Your Email',validators=[Required(),Email()])recaptcha=RecaptchaField()submit=SubmitField('Submit')