Django

Code

Ticket #376 (closed: wontfix)

Opened 3 years ago

Last modified 3 months ago

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

Reported by: Manuzhai Assigned to: nobody
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 1

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

modpython2.py (6.6 kB) - added by Manuzhai on 08/20/05 10:30:58.
Handler for mod_python2. Hasn't been tested extensively.
modpython2.2.py (6.3 kB) - added by Sanel on 01/18/07 07:01:10.
Modified Manuzhai's patch for 0.95
modpython2_svn.py (6.7 kB) - added by Sanel on 01/19/07 17:39:37.
Synced mod_python 2.x changes with latest svn code
django-modpython.patch (4.0 kB) - added by Andrew Fedorov on 08/30/07 19:44:01.
Universal mod_python (2.x, 3.x) handler, synced with svn code.
django-modpython.2.patch (4.2 kB) - added by Andrew Fedorov on 08/31/07 12:30:55.
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 on 09/08/07 15:04:07.
Small fix and comments
django-modpython2-support.patch (4.5 kB) - added by Andrew Fedorov on 01/16/08 18:42:42.
Updated patch for revision 7020

Change History

08/20/05 10:30:58 changed by Manuzhai

  • attachment modpython2.py added.

Handler for mod_python2. Hasn't been tested extensively.

08/20/05 10:37:29 changed 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 '^$'.

08/20/05 10:40:40 changed by Manuzhai

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

08/20/05 11:56:08 changed by adrian

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

09/06/05 22:40:03 changed by anonymous

  • type changed from defect to enhancement.
  • component changed from Admin interface to Core framework.

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.

09/07/05 01:19:18 changed 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.

09/26/05 23:34:55 changed 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

11/06/05 17:15:37 changed by adrian

  • status changed from new to closed.
  • resolution set to invalid.

Please reopen when you've got this working.

01/18/07 07:01:10 changed by Sanel

  • attachment modpython2.2.py added.

Modified Manuzhai's patch for 0.95

01/18/07 07:03:50 changed by Sanel

  • has_patch set to 1.
  • version set to 0.95.
  • needs_tests set to 1.

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.

01/19/07 11:03:06 changed by adrian

  • status changed from closed to reopened.
  • needs_better_patch set to 1.
  • stage changed from Unreviewed to Accepted.
  • resolution deleted.
  • needs_docs set to 1.

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.

01/19/07 17:39:37 changed by Sanel

  • attachment modpython2_svn.py added.

Synced mod_python 2.x changes with latest svn code

01/19/07 17:46:03 changed by Sanel

  • needs_better_patch deleted.
  • version changed from 0.95 to SVN.
  • needs_docs deleted.

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 :)

05/10/07 13:12:37 changed 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.

05/10/07 18:12:50 changed 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.

06/13/07 10:09:22 changed by JFM <jmcbray@carcosa.net>

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.

08/30/07 19:44:01 changed by Andrew Fedorov

  • attachment django-modpython.patch added.

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

08/30/07 20:00:09 changed 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.

08/31/07 12:30:55 changed by Andrew Fedorov

  • 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).

09/02/07 18:20:14 changed by SmileyChris

  • needs_better_patch set to 1.

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

09/07/07 16:30:20 changed by jacob

  • 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.

09/08/07 15:04:07 changed by Andrew Fedorov

  • attachment django-modpython.3.patch added.

Small fix and comments

01/16/08 18:42:42 changed by Andrew Fedorov

  • attachment django-modpython2-support.patch added.

Updated patch for revision 7020

06/07/08 19:13:43 changed 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).

06/14/08 11:07:23 changed 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.

06/16/08 12:26:03 changed 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?

09/05/08 18:56:38 changed by adrian

  • status changed from reopened to closed.
  • resolution set to wontfix.

Closing because mod_python 2 is old.

09/06/08 05:27:28 changed 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.


Add/Change #376 (Add a handler for mod_python v. 2 (Django requires v. 3))




Change Properties
Action