python scripts for web

Zero Piraeus schesis at gmail.com
Thu Oct 18 03:57:34 EDT 2012


:

On 18 October 2012 03:18,  <chip9munk at gmail.com> wrote:
> Here is what I need to do: on some webpage (done in php, or any other
> different technology), user inputs some data, that data and the
> request then goes to the server where python scripts calculate
> something and return the result to the users end.
>
> Now, how do I do that server part, listening to requests, and calling
> python scripts?

If I understand you correctly, what you're describing here is a
webserver - i.e. Apache, nginx etc. I'm not sure why you'd want to
write one of those if you're as inexperienced as you say.

> I googled about that but I do not understand if I should do that by
> CGI, Flask, mod_wsgi, or any other way... I know to little about that
> to understand what is the way to go. :/

These are all approaches to writing the software that the webserver
hands the request off to, which is a different thing. If that's what
you really meant to ask (how to write a script that processes a
request and returns a response), then plain CGI might be the best
place to start, if you're trying to get a handle on what's going on.

Once you're happy that you understand how to build a plain CGI script,
frameworks [like Flask] can be very useful ... and Flask is both
lightweight and has good documentation, so it's not a bad choice for
learning purposes.

 -[]z.



More information about the Python-list mailing list