Instead of 3), for mod_python you can create a wrapper around
ModPythonHandler like this example from the Pinax Project:

http://svn.pinaxproject.com/pinax/trunk/projects/basic_project/deploy/modpython.py

import os
import sys

from os.path import abspath, dirname, join
from site import addsitedir

from django.core.handlers.modpython import ModPythonHandler

class PinaxModPythonHandler(ModPythonHandler):
    def __call__(self, req):
        # mod_python fakes the environ, and thus doesn't process
SetEnv.
        # This fixes that. Django will call this again since there is
no way
        # of overriding __call__ to just process the request.
        os.environ.update(req.subprocess_env)
        from django.conf import settings

        sys.path.insert(0, abspath(join(dirname(__file__), "../../")))

        sys.path.insert(0, join(settings.PINAX_ROOT, "apps"))
        sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))

        return super(PinaxModPythonHandler, self).__call__(req)

def handler(req):
    # mod_python hooks into this function.
    return PinaxModPythonHandler()(req)


Then in your httpd.conf point to this rather than the default django
handler:

 PythonHandler myproject.deploy.modpython

Also, here's a little plug for virtualenv, which I use in addition to
the above.

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

Reply via email to