I'm new at this, however, when it comes to configuring mod_python/apache or wsgi/apache I suffer.
I've been able to use the python debugger tool.. pdb.set_trace()
to success, especially when using the django development server, i.e. it out puts to the terminal all of the server activity, including the pdb interface.
So, how does one do something like this when trying to deploy a django website on an host such as webfaction?
Other than ftp into the error_log and read about it post failure, be able to interact with the system, as its happening?
Hopefully I'm clear enough here.
Btw, following is the file that I'm trying to configure.
import os
import sys
from os.path import abspath, dirname, join
from site import addsitedir
from django.core.handlers.modpython import ModPythonHandler
import pdb
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, os.path.join(settings.PINAX_ROOT, "apps/external_apps"))
sys.path.insert(0, os.path.join(settings.PINAX_ROOT, "apps/local_apps"))
sys.path.insert(0, join(settings.PINAX_ROOT, "apps"))
sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
pdb.set_trace()
return super(PinaxModPythonHandler, self).__call__(req)
def handler(req):
# mod_python hooks into this function.
return PinaxModPythonHandler()(req)
and here's the resulting error page via http:
MOD_PYTHON ERROR
ProcessId: 318
Interpreter: 'web25.webfaction.com'
ServerName: 'web25.webfaction.com'
DocumentRoot: '/etc/httpd/htdocs'
URI: '/'
Location: '/'
Directory: None
Filename: '/etc/httpd/htdocs'
PathInfo: '/'
Phase: 'PythonHandler'
Handler: 'bc.deploy.modpython'
Traceback (most recent call last):
File "/home/dalidada/webapps/birthconfidence/lib/python2.5/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/home/dalidada/webapps/birthconfidence/lib/python2.5/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/home/dalidada/webapps/birthconfidence/lib/python2.5/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/home/dalidada/webapps/birthconfidence/bc/deploy/modpython.py", line 33, in handler
return PinaxModPythonHandler()(req)
File "/home/dalidada/webapps/birthconfidence/bc/deploy/modpython.py", line 29, in __call__
return super(PinaxModPythonHandler, self).__call__(req)
File "/home/dalidada/webapps/birthconfidence/lib/python2.5/django/core/handlers/modpython.py", line 191, in __call__
self.load_middleware()
File "/home/dalidada/webapps/birthconfidence/lib/python2.5/django/core/handlers/base.py", line 40, in load_middleware
raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)
ImproperlyConfigured: Error importing middleware django_openid.consumer: "No module named django_openid.consumer"