How to create a voting website by Python and Flask?

H

Harry Wood

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!
 
D

David Froger

Quoting Harry Wood (2014-03-03 16:22:22)
How to create a voting website by Python and Flask? I studying Python andFlask 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!

Hi Harry,

For example:

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
render_template('result.html', result=result)

Hope it helps!
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,835
Latest member
lila30

Latest Threads

Top