Hello,

I'm going to work on some patches to improve WSGI support, and I found 
something that, if changed, could make my patches and django.core.handlers 
simpler... As well as make it possible to use WSGI middleware with Django 
under mod_python.

At the moment, Django has two so-called handlers: One for any WSGI gateway 
like mod_wsgi, and another just for mod_python. Each handler has its own 
request class. And the handlers and the request classes have their respective 
base classes:
+ BaseHandler
  - WSGIHandler
  - ModPythonHandler
+ HttpRequest
  - WSGIRequest
  - ModPythonRequest

Instead of having these 6 classes, we could get rid of the mod_python handler, 
and then merge the base and WSGI handlers together to have just "Handler" (or 
"HttpHandler") and "HttpRequest", with no subclasses.

I don't know if the Django community wants to keep support for mod_python now 
that it's officially dead. If so, I would suggest using a mod_python<->WSGI 
wrapper, which I believe is better than having a separate handler:

 1.- There would be only one type of request, which means:
     - It'd be less likely for a Django application to behave differently on 
mod_python vs mod_wsgi; or mod_python vs FastCGI; etc.
     - All the new WSGI-related features I am implementing will be 
automatically available under mod_python.
 2.- It'd be possible to use WSGI middleware under mod_python.

There would be three ways to keep support for mod_python with the two 
advantages above:
 1.- Adapting the existing code the mod_python handler and also applying the 
changes I proposed in the patch for ticket #8927.
 2.- Copying the following module (Public Domain) into Django:
http://www.aminus.net/browser/modpython_gateway.py
 3.- Not adding mod_python support in Django itself, but instead recommend 
using a mod_python<->WSGI wrapper like paste.modwsgi:
http://bitbucket.org/ianb/paste/src/tip/paste/modpython.py

I am willing to provide a patch for this and I wouldn't mind using any of 
these three approaches. But if you ask me, I think no one should be using 
mod_python at this point and therefore I'd suggest dropping support for 
mod_python (the 3rd option):
http://blog.dscpl.com.au/2010/05/modpython-project-soon-to-be-officially.html
http://blog.dscpl.com.au/2010/06/modpython-project-is-now-officially.html

To sum up, I'm proposing two things:
 1.- Making the WSGI handler the only handler.
 2.- If we want to keep mod_python support, use a mod_python<->WSGI wrapper.

What do you think?

PS: You may want to see the latest comments on Ticket #8927:
http://code.djangoproject.com/ticket/8927
-- 
Gustavo Narea <xri://=Gustavo>.
| Tech blog: =Gustavo/(+blog)/tech  ~  About me: =Gustavo/about |

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to