2

Is there some way to run .psp (python server pages) code under apache + mod_wsgi? While we are moving towards newer wsgi based frameworks we still have some legacy code written in psp which runs under mod_python.

We'd like to be able to run it on the same server that hosts other wsgi based python code. In short - is there a way to support psp under mod_wsgi? Or are there any other tricks to at least allow mod_wsgi and mod_python to play nice in the same server?

-S

Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
shreddd
  • 10,975
  • 9
  • 33
  • 34
  • PSP!?!? (Googling) Oh, YUCK! http://www.modpython.org/live/current/doc-html/pyapi-psp.html Why would you want to bring the mistakes of PHP and ASP to Python? That's *evil*. – Lennart Regebro Jan 27 '10 at 08:43
  • The issue here is legacy code. While we don't want to write new PSP code there is some existing stuff that needs to work. We want to write newer apps under Django, but until the legacy code is ported over we still need to be able to run in a mode where we can use both mod_python/psp and mod_wsgi/django. – shreddd Jan 28 '10 at 15:56

1 Answers1

1

No, there is no port of mod_python PSP for mod_wsgi.

Yes, you can run mod_python and mod_wsgi on same server so long as both use same version of Python and both link dynamically with Python library. See:

http://code.google.com/p/modwsgi/wiki/InstallationIssues

It isn't recommended to run both together though as mod_wsgi then gets afflicted by the memory leaks due to mod_python, plus some other configurability in mod_wsgi is restricted due to mod_python controlling Python interpreter initialisation.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • Wouldn't running the WSGI apps in daemon mode mitigate the initialization issues? – Ignacio Vazquez-Abrams Jan 27 '10 at 01:44
  • 1
    No, daemon mode processes are a fork of Apache parent and not a fork/exec like in FASTCGI. Thus there isn't the total isolation there is in FASTCGI. Being only a fork provides other benefits though as far as better integration with Apache and better process management. So, where you gain in one area, you loose in others. – Graham Dumpleton Jan 27 '10 at 04:32
  • Thanks Graham - will play with the dual install and see what happens. – shreddd Jan 28 '10 at 15:58
  • As described in the link, the issue was a mod_wsgi that had a dynamically linked libpython and a mod_python that had it statically linked. Recompiled mod_python to link against libpython dynamically and it seems to be working now. Thanks again. One more side note: mod_python won't link dynamically against libpython by default. Had to change the configure script to get this to work right. Need to change LDFLAGS="${LDFLAGS} -L${PyLIBPL}" to LDFLAGS="${LDFLAGS}" – shreddd Jan 28 '10 at 20:39
  • 1
    Latest mod_wsgi explicitly bombs out if mod_python is loaded. I tried working around it (in the mod_wsgi code), but it well and truly doesn't work any more, so mod_python and the latest mod_wsgi are mutually exclusive. – IanSR Sep 08 '11 at 22:09
  • The unreleased code in mod_wsgi source code repository will not work with mod_python loaded at the same time. And yes that is by design, but why are you using not yet finished mod_wsgi 4.0 rather than mod_wsgi 3.3 official tar ball? FWIW, the reason they can no longer coexist is that mod_wsgi had to remove the hacks in it to compensate for broken thread usage in mod_python. If this wasn't done, it would have been extremely painful to have mod_wsgi support Python 3.2. It just wasn't worth it try to conditionally have two different ways of handling threads any more. – Graham Dumpleton Sep 09 '11 at 03:53