Hi Kenneth,

Are you using VirtualHosts? I had problem with them on some machine, and I moved to someother without virtual hosts and it worked.

On 2/23/06, Kenneth Kalmer <[EMAIL PROTECTED]> wrote:

Guys

I've scoured google, this list and the docs for two days now and I
simply can't get django to work with mod_python. Here is some detail
first:

httpd-2.0.52-22.ent.centos4
python-2.3.4-14.1
mod_python-3.1.3-5.1
MySQL-python-1.0.0-1.RHEL4.1

This is a seperate httpd instance to the one with PHP5 in. So, I have
two instances running, one for PHP5 and a different one for
mod_python.

First I followed the normal "Testing mod_python" steps creating the
mptest handler and it worked. Then I import pyexpat and MySQLdb to
test them and they worked.

Playing around I got to this point now where I have the following code
in a .htaccess file

<.htaccess>
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
SetEnv foo bar
AddHandler mod_python .py
PythonHandler mptest
PythonAutoReload On
PythonDebug On
</.htaccess>

and this in mptest.py

<mptest.py>
import pyexpat
import MySQLdb
from mod_python import apache
import os, sys, thread, time
def handler(req):
    req.content_type = 'text/plain'
    req.send_http_header()
    req.write ('mptest.py\n')
    req.write(os.environ['foo'])
    req.write(str(sys.path))
    return apache.OK
</mptest.py>

and the output is

<output>
mptest.py

<pre>
Mod_python error: "PythonHandler mptest"

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
    result = object(req)

  File "/home/clearplanet.co.za/public_html/python/mptest.py", line
33, in handler
    req.write(os.environ['foo'])

  File "/usr/lib/python2.3/UserDict.py", line 19, in __getitem__
    def __getitem__(self, key): return self.data[key]

KeyError: 'foo'

</pre>
</output>

So, no matter what I "SetEnv", it doesn't run through mod_python to my
scripts. Apart from the SetEnv issue, I've imported most of the django
modules into the above code as recommended by Adrian in the docs, and
they all imported successfully, or at least until something triggers
the django handler to take over and it complains about the
DJANGO_SETTINGS_MODULE not being set.

The catch here is, I did this after I had problems with my actual
project not working. My original project shows the django 404 whenever
I request a page that isn't configured in urls.py, but whenever I
access a view that does exist I get the all too popular "Segfault
(11)" and mod_python reloads the django handler.

I've tried everything I can think of, and every suggestion that has
been made on the list to date, but to no avail. Can anyone suggest
some additional steps that I can take to produce valuable information?
How will I get the SetEnv directives working correctly?

I'm off to bed now, I'll check my mail as soon as I hit the desk again...

Thanks in advance

--

Kenneth Kalmer
[EMAIL PROTECTED]

[EMAIL PROTECTED] stats
http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=kenneth%2Ekalmer
Blog:
http://www.rootshell.be/~upadhyay
+91-9867-359-701
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to