How to create a voting website by Python and Flask?
david.froger at inria.fr
Mon Mar 3 17:01:49 CET 2014
Quoting Harry Wood (2014-03-03 16:22:22)
> How to create a voting website by Python and Flask? I studying Python and Flask for some months, and
> - Now I have some Python & Flask basic skills.
> - I need some advices like following example:
> Step 1: You could writing an voting application by Python Step 2: You could build a website by Flask ...
> Thanks very much!
You define an URL, something like /voting. Used with a GET request, the Python
function associated to the /voting URL renders and returns a template
containing a form. You can create the form using Flask-WTF, and use
Flask-Bootstrap to make your page looks better. The user fill the form, and
submit it (POST request on /voting). Here, the function associated with
/voting get the form data, and store it in a database.
You define a second URL, /results, which on a GET request reads your database
and returns the results by rendering a template, something like
Hope it helps!
More information about the Python-list