Mod_wsgi, mod_python or just cgi?

I played with my own web server (Apache + Ubuntu) and python. From what I saw, there are 3 (?) Main ways to do this:

  • Apache is configured to handle .py as cgi
  • Apache is configured to use mod_python, which is now deprecated (?)
  • Apache is configured to use mod_wsgi

I remember reading that Django prefers mod_wsgi, and I'm interested in learning Django (I heard that their official guide is pretty excellent).

What is a β€œrecommended” setting? I suppose there really is no reason to use mod_python, but what are the differences between handling .py like cgi and mod_wsgi? Is it possible to run them in tandem (and do you want to?), Or is it just a ridiculous idea, and I have to stop thinking about such crazy things?

I think I'm actually just looking for a tutorial for Apache + Python (the links are also good) - none of the things that I have yet to come across were terribly informative - they were basically just somehow.

+41
python apache cgi mod-wsgi
Jul 23 2018-10-23T00:
source share
4 answers

mod_python is dead, so using mod_python is probably not a good idea for new projects. Personally, I prefer to use mod_wsgi via CGI (or FastCGI). He is dead - easy to set up and much more efficient.

+30
Jul 23 '10 at 15:20
source share
  • Do not use CGI. It is inefficient. Create a new process for each request. No thanks

  • Do not spend much time on mod_python

  • Use mod_wsgi.

If you want to write CGI-like things without a frame, use mod_wsgi anyway. The WSGI standard ( PEP 333 ) is required for building web applications in a simple, interchangeable, reusable, plug-in, and playable version.

+15
Jul 23 '10 at 3:19
source share

I would also go with mod_wsgi.

If you want a deeper understanding of the issue, look at this:

Good stuff!

+8
Jul 23 '10 at 16:03
source share

mod_python

mod_python is alive and well. See here: http://modpython.org/ . Also here is the documentation for the latest version, 3.5.0, with Python 3 support: http://modpython.org/live/current/modpython.pdf . I am currently using it.

mod_wsgi

mod_wsgi thinks of itself as that it cannot be used with barebone, but with a framework like Flask.

+7
Nov 30 '13 at 2:34
source share



All Articles