Opened 19 years ago

Closed 16 years ago

Last modified 16 years ago

#376 closed enhancement (wontfix)

Add a handler for mod_python v. 2 (Django requires v. 3)

Reported by: Manuzhai Owned by: nobody
Component: Core (Other) Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I've adapted the mod_python handler to also work on mod_python 2. The differences with the mod_python 3 are fairly small, but it's still somewhat incompatible. In addition, I think you need an index.py file to make it work with the '/' URL given to a basic address. Here's the config I'm using, I'll attach modpython2.py.

<Location />
    SetHandler python-program
    AddHandler python-program .py
    DirectoryIndex index.py
    PythonHandler django.core.handlers.modpython2
    PythonPath "['/home/dirkjan/dev'] + sys.path"
    PythonInterpreter weblog.main
    PythonDebug On
    SetEnv DJANGO_SETTINGS_MODULE weblog.settings.main
</Location>

Attachments (7)

modpython2.py (6.6 KB ) - added by Manuzhai 19 years ago.
Handler for mod_python2. Hasn't been tested extensively.
modpython2.2.py (6.3 KB ) - added by Sanel 17 years ago.
Modified Manuzhai's patch for 0.95
modpython2_svn.py (6.7 KB ) - added by Sanel 17 years ago.
Synced mod_python 2.x changes with latest svn code
django-modpython.patch (4.0 KB ) - added by Andrew Fedorov 17 years ago.
Universal mod_python (2.x, 3.x) handler, synced with svn code.
django-modpython.2.patch (4.2 KB ) - added by Andrew Fedorov 17 years ago.
Universal mod_python (2.x, 3.x) handler, synced with svn code (with ap_auth_type and user for mod_python2.x).
django-modpython.3.patch (4.9 KB ) - added by Andrew Fedorov 17 years ago.
Small fix and comments
django-modpython2-support.patch (4.5 KB ) - added by Andrew Fedorov 16 years ago.
Updated patch for revision 7020

Download all attachments as: .zip

Change History (28)

by Manuzhai, 19 years ago

Attachment: modpython2.py added

Handler for mod_python2. Hasn't been tested extensively.

comment:1 by Manuzhai, 19 years ago

index.py doesn't actually need to contain anything; touch index.py will do.

There is currently a problem with the Admin interface complaining that it doesn't recognize index.py. This can be fixed by loosening the regex for djano.views.admin.main.index to '' instead of '^$'.

comment:2 by Manuzhai, 19 years ago

Okay, seems there's a problem with the cookie support in the handler, I'll investigate it.

comment:3 by Adrian Holovaty, 19 years ago

Very cool, Manuzhai -- thanks! Let us know when you think it's stable (cookie support, etc.), and we'll roll it in.

comment:4 by anonymous, 19 years ago

Component: Admin interfaceCore framework
Type: defectenhancement

Hey Manuzhai, about cookie support for mod_python 2.7 , check this url:
http://www.modpython.org/FAQ/faqw.py?req=show&file=faq05.009.htp

That should deal with the cookie/session issues.

comment:5 by Manuzhai, 19 years ago

Good point! Unfortunately, the box where I was developing this has gone MIA, and I'm not sure whether I'll be able to test this on another server.

comment:6 by Adrian Holovaty, 19 years ago

Summary: Handler for mod_python 2Add a handler for mod_python v. 2 (Django requires v. 3)

Please reopen when you've got the

comment:7 by Adrian Holovaty, 18 years ago

Resolution: invalid
Status: newclosed

Please reopen when you've got this working.

by Sanel, 17 years ago

Attachment: modpython2.2.py added

Modified Manuzhai's patch for 0.95

comment:8 by Sanel, 17 years ago

Has patch: set
Needs tests: set
Version: 0.95

I tweaked Manuzhai ideas into 0.95. As far as I could test, it works fine on apache 1.3.x and mod_python 2.x, including admin interface.

Please, if you find problems, post them here, so I can track them.

comment:9 by Adrian Holovaty, 17 years ago

Needs documentation: set
Patch needs improvement: set
Resolution: invalid
Status: closedreopened
Triage Stage: UnreviewedAccepted

Reopening this because it seems to have a champion. However, the patch is not acceptable, as it's based on our modpython.py handler from a long time ago. That handler has changed since then, and this patch will need to incorporate those changes. For example, ModPythonRequest.__repr__() has changed, and settings.ENABLE_PSYCO no longer exists.

I'd suggest starting with the current django/core/handlers/modpython.py and tweaking it to making the mod_python version 2 changes.

by Sanel, 17 years ago

Attachment: modpython2_svn.py added

Synced mod_python 2.x changes with latest svn code

comment:10 by Sanel, 17 years ago

Needs documentation: unset
Patch needs improvement: unset
Version: 0.95SVN

Tweaked to reflect latest svn code, as requested.

Btw. issue with '/' at the end of url is resolved, and now it will behave as in mod_python 3.x case :)

comment:11 by daniel, 17 years ago

What's the status of this? Is it going to be supported in the core? It solved my problem with a host using Apache 1.3.37 and mod_python 2.7.11. I think I've convinced them to upgrade to Apache 2.x and mod_python 3.x, but in the meantime this works nicely.

I don't like being out of synch with the Django trunk, however.

comment:12 by James Bennett, 17 years ago

Please don't ask "when will this be merged in" questions in this ticket tracker; it increases the amount of noise developers have to wade through while evaluating tickets. The appropriate venue for this sort of discussion is the mailing list.

comment:13 by JFM <jmcbray@…>, 17 years ago

The changes in the latest synced mod_python v.2 version vs. the mod_python v.3 handler in SVN look very small. Is there any way to determine the mod_python version at runtime, so that the v.2 handler and the v.3 handler could be merged? At worst, either through configuration in Django settings, or just trying the v.3 method and using the v.2 method on an exception? I think that if they were in the same file, the v.2 version would be less likely to bit-rot.

I'm not able to test this currently, as I don't have an Apache 1.3/mod_python 2.x installation available, but I expect to soon.

by Andrew Fedorov, 17 years ago

Attachment: django-modpython.patch added

Universal mod_python (2.x, 3.x) handler, synced with svn code.

comment:14 by Andrew Fedorov, 17 years ago

Hello. I've attached patch for current svn mod_python handler. With patch hadler works with both (2.x, 3.x) version of mod_python. Have tested it on my home server - Apache 2.0.58, mod_python 3.2.10; and on remote hosting - apache 1.3.37, mod_python 2.7.11. Although i need more time to check stability.

by Andrew Fedorov, 17 years ago

Attachment: django-modpython.2.patch added

Universal mod_python (2.x, 3.x) handler, synced with svn code (with ap_auth_type and user for mod_python2.x).

comment:15 by Chris Beaven, 17 years ago

Patch needs improvement: set

Ticket looks pretty good! Could probably use some inline comments whenever code has been reverted to be mod_python 2 compatible.

comment:16 by Jacob, 17 years ago

Triage Stage: Design decision neededAccepted

I'd like to get more testing done on this patch since it's a pretty damn critical area, but the idea's fine in theory. Marking accepted.

by Andrew Fedorov, 17 years ago

Attachment: django-modpython.3.patch added

Small fix and comments

by Andrew Fedorov, 16 years ago

Updated patch for revision 7020

comment:17 by Marc Fargas, 16 years ago

Altought the ticket is marked as Accepted (in 2007), the latest release of mod_python 2 was in 2004.
Are we really willing to maintain support for it? (Altough it seem somebody is using this, or at least was 6 months ago).

comment:18 by Andrew, 16 years ago

Still using (and maintaining) the patch because we can't move to Apache2 right now. Patch is valid for the trunk head. But if nobody other uses it feel free to close the ticket.

comment:19 by mrts, 16 years ago

-1 for including this, mod_python 2 should really not be officially supported. Andrew, perhaps you can upload your patch to djangosnippets and close the ticket?

comment:20 by Adrian Holovaty, 16 years ago

Resolution: wontfix
Status: reopenedclosed

Closing because mod_python 2 is old.

comment:21 by Graham Dumpleton, 16 years ago

If one really needs to use Apache 1.3, then one can use mod_wsgi instead anyway as it supports that version of Apache.

Note: See TracTickets for help on using tickets.
Back to Top