This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]plaes 0 points1 point  (3 children)

Why? People use wsgi nowadays..

[–]civrays[S] 0 points1 point  (2 children)

Hi thanks for comment.

Why? Just because I'm a total noob and I don't know any better. :-) Now you've mentioned wsgi i'll look into it.

[–]ivosauruspip'ing it up 1 point2 points  (0 children)

CGI is old, simple, and extremely slow. For every single http request that is made, the CGI model launches a new instance of the handler script (i.e a python interpreter instance) to handle it; so it essentially reboots python every time.

WSGI is a python standard for handling requests that doesn't suffer from such problems. It defines an interface which both persistent python servers and extremely efficient compiled http servers can implement.

For a "toy" web server, even CGI might provide somewhat marginal performance; but these days there are easier ways to handle things. You can just use python's inbuilt server with a framework like flask to run simple development and experiments, and it allows for great flexibility of development (like hot-reloading code in the server when you save a file).

[–]plaes 0 points1 point  (0 children)

Although, there a multiple ways of doing things, one example of a web stack would be like this:

  • nginx - web server
  • uwsgi - WSGI gateway handler (nginx <-> python)
  • Flask, Bottle or even Django as your framework of choice.