Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67562

Re: How to create a voting website by Python and Flask?

From David Froger <david.froger@inria.fr>
References <39d907df-7fc9-4843-ab8a-cb6a16e668a9@googlegroups.com>
Subject Re: How to create a voting website by Python and Flask?
Date 2014-03-03 17:01 +0100
Newsgroups comp.lang.python
Message-ID <mailman.7648.1393862577.18130.python-list@python.org> (permalink)

Show all headers | View raw


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!
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to create a voting website by Python and Flask? Harry Wood <andywu1206@gmail.com> - 2014-03-03 07:22 -0800
  Re: How to create a voting website by Python and Flask? David Froger <david.froger@inria.fr> - 2014-03-03 17:01 +0100

csiph-web