Opened 10 years ago

Closed 6 years ago

Last modified 6 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: master
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: UI/UX:

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 10 years ago.
Handler for mod_python2. Hasn't been tested extensively.
modpython2.2.py (6.3 KB) - added by Sanel 8 years ago.
Modified Manuzhai's patch for 0.95
modpython2_svn.py (6.7 KB) - added by Sanel 8 years ago.
Synced mod_python 2.x changes with latest svn code
django-modpython.patch (4.0 KB) - added by Andrew Fedorov 8 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 8 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 7 years ago.
Small fix and comments
django-modpython2-support.patch (4.5 KB) - added by Andrew Fedorov 7 years ago.
Updated patch for revision 7020

Download all attachments as: .zip

Change History (28)

Changed 10 years ago by Manuzhai

Handler for mod_python2. Hasn't been tested extensively.

comment:1 Changed 10 years ago by Manuzhai

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 Changed 10 years ago by Manuzhai

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

comment:3 Changed 10 years ago by adrian

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

comment:4 Changed 9 years ago by anonymous

  • Component changed from Admin interface to Core framework
  • Type changed from defect to enhancement

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 Changed 9 years ago by Manuzhai

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 Changed 9 years ago by adrian

  • Summary changed from Handler for mod_python 2 to Add a handler for mod_python v. 2 (Django requires v. 3)

Please reopen when you've got the

comment:7 Changed 9 years ago by adrian

  • Resolution set to invalid
  • Status changed from new to closed

Please reopen when you've got this working.

Changed 8 years ago by Sanel

Modified Manuzhai's patch for 0.95

comment:8 Changed 8 years ago by Sanel

  • Has patch set
  • Needs tests set
  • Version set to 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 Changed 8 years ago by adrian

  • Needs documentation set
  • Patch needs improvement set
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Unreviewed to Accepted

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.

Changed 8 years ago by Sanel

Synced mod_python 2.x changes with latest svn code

comment:10 Changed 8 years ago by Sanel

  • Needs documentation unset
  • Patch needs improvement unset
  • Version changed from 0.95 to SVN

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 Changed 8 years ago by daniel

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 Changed 8 years ago by ubernostrum

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 Changed 8 years ago by JFM <jmcbray@…>

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.

Changed 8 years ago by Andrew Fedorov

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

comment:14 Changed 8 years ago by Andrew Fedorov

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.

Changed 8 years ago by Andrew Fedorov

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

comment:15 Changed 7 years ago by SmileyChris

  • 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 Changed 7 years ago by jacob

  • Triage Stage changed from Design decision needed to Accepted

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.

Changed 7 years ago by Andrew Fedorov

Small fix and comments

Changed 7 years ago by Andrew Fedorov

Updated patch for revision 7020

comment:17 Changed 7 years ago by telenieko

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 Changed 7 years ago by Andrew

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 Changed 7 years ago by mrts

-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 Changed 6 years ago by adrian

  • Resolution set to wontfix
  • Status changed from reopened to closed

Closing because mod_python 2 is old.

comment:21 Changed 6 years ago by grahamd

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