Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Help running Django with mod_python [RSS Feed]

#1 Dec. 1, 2005 14:29:39

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


I'm trying to setup Django with Apache and mod_python.

I have followed the procedure described in the document "how to use
Django with mod_python", but I can't obtain a working basic (single
Django installation on the same Apache) environment, because Apache
unexpectedly crashes at each request.

It happens that a blank page (no response) is returned to the browser
when a request is made.

These strings appear in error_log:
mod_python: Creating 32 session
mutexes based on 150 max processes and 0 max threads.
Apache/2.0.55 (Unix)
mod_python/3.1.4 Python/2.3.5 configured -- resuming normal operations
mod_python: (Re)importing module
'django.core.handlers.modpython'
child pid 15299 exit signal
Segmentation fault (11)

Looking around for some pointer I have discovered that some
incompatibilities might generate this problem. It is the case (but
there are others) of embedded Python's version of expat and Apache's
linked version of expat that differ. However in my setup they are the
same.

As I have spent a lot of time on this without results, and the cause
of this bad behavior maybe is something simple for an experienced
user, I'd really love some help.

Thanks in advance!

Offline

#2 Dec. 1, 2005 14:48:16

A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


On 1 Dec 2005, at 14:29, Paolo wrote: child pid 15299 exit signal
Segmentation fault (11)Ah, I spent a frustrating few hours wrestling with this error (or onelike it) last night. Are you using mod_python 3? After buildingmod_python have you fully restarted Apache or just gracefullyrestarted it?________________________________
Afternoon, man about the Internet --http://aftnn.org/

Offline

#3 Dec. 1, 2005 15:24:42

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


2005/12/1, Afternoon <>:
>
>
> On 1 Dec 2005, at 14:29, Paolo wrote:
>
> > child pid 15299 exit signal
> > Segmentation fault (11)
>
> Ah, I spent a frustrating few hours wrestling with this error (or one
> like it) last night. Are you using mod_python 3? After building
> mod_python have you fully restarted Apache or just gracefully
> restarted it?

Hi Afternoon, not only I have restarted Apache after building
mod_python (3.1.4), I also have updated it from version 2.0.54 to
2.0.55, but nothing has changed.

Offline

#4 Dec. 1, 2005 15:51:24

A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


On 1 Dec 2005, at 15:24, Paolo wrote:Hi Afternoon, not only I have restarted Apache after building
mod_python (3.1.4), I also have updated it from version 2.0.54 to
2.0.55, but nothing has changed.Hang on, it's coming back to me now (sorry, it was a long night).What platform are you building on? Where is your Python? I had todefine PYTHONHOME = /usr/ in envopts for Apache because I'm runningOS X and my Python is stock but my Apache comes from the Fink project.Is there any way that Apache might not be able to find Python such asthis?________________________________
Afternoon, man about the Internet --http://aftnn.org/

Offline

#5 Dec. 1, 2005 20:26:22

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


2005/12/1, Afternoon <>:
>
> What platform are you building on? Where is your Python? I had to
> define PYTHONHOME = /usr/ in envopts for Apache because I'm running
> OS X and my Python is stock but my Apache comes from the Fink project.
>
> Is there any way that Apache might not be able to find Python such as
> this?

Well, my experiments take place on linux slackware, kernel 2.4.26.
Running a simple mod_python test handler, like the one to test if
mod_python installation has completed succesfully
(http://www.modpython.org/live/current/doc-html/inst-testing.html),
happens without problems. This make me think that
apache/mod_python/python installation is fine and that the problem is
in httpd.conf or in my project.

So I'll post them. This is the relevant part of httpd.conf:
<VirtualHost 192.168.0.68:85>
DocumentRoot /home/paolo/projects/django
<Location /admin/>
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonPath +sys.path
SetEnv DJANGO_SETTINGS_MODULE cardano.settings
</Location>
</VirtualHost>

and this is urlpatterns:
urlpatterns = patterns('',
(r'^admin/', include('django.contrib.admin.urls.admin')),
)

Project cardano lives in /home/paolo/projects/django

Thanks

Offline

#6 Dec. 1, 2005 20:59:30

A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


This make me think that
apache/mod_python/python installation is fine and that the problem is
in httpd.conf or in my project.The fact that the child process is dying suggests something fairlylow-level, but if you have another MP handler that works OK that's abit strange. I always had either one or the other. Although I confessI didn't test another handler, I did start getting stack traces whenI fixed a few bits.Have you tried adding PythonDebug On to your httpd.conf? Also, I'musing SetHandler python-program, no idea if that makes any differencethough.________________________________
Afternoon, man about the Internet --http://aftnn.org/

Offline

#7 Dec. 1, 2005 21:04:37

Bryan M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


On 12/1/05, Paolo <> wrote:
>
> I'm trying to setup Django with Apache and mod_python.
>
> I have followed the procedure described in the document "how to use
> Django with mod_python", but I can't obtain a working basic (single
> Django installation on the same Apache) environment, because Apache
> unexpectedly crashes at each request.

Do you have mod_php running too? See this:http://www.modpython.org/pipermail/mod_python/2004-January/014886.htmlBryan

Offline

#8 Dec. 2, 2005 07:21:11

frank h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


hej paolo,
I am on OS X as well, and I had problems with Apache and mod_python.
Turns out that my python (version 2.4.1 from fink) was the problem.

the following worked for me:

stop any apache that is currently running (fink or buildin)

install python 2.4.1 framework build fromhttp://undefined.org/python/(you might need to install the Tiger patch as well)

set /usr/local/bin as first in $PATH

install apache2:
curl -Ohttp://www.apache.org/dist/httpd/httpd-2.0.55.tar.gztar xvfz httpd-2.0.55.tar.gz
cd httpd-2.0.55
./configure --enable-so --with-mpm=worker
make
sudo make install

install mod_python:
curl -Ohttp://www.apache.org/dist/httpd/modpython/mod_python-3.1.4.tgztar xvfz mod_python-3.1.4.tgz
cd mod_python-3.1.4
./configure --with-apxs=/usr/local/apache2/bin/apxs
--with-python=/usr/local/bin/python
make
sudo make install

sudo edit /usr/local/apache2/conf/httpd.conf
>LoadModule python_module /usr/local/apache2/modules/mod_python.so

then follow the instructions herehttp://www.djangoproject.com/documentation/modpython/or
herehttp://cavedoni.com/2005/django-osxto configure django

then start the new apache2 install (check
/usr/local/apache2/logs/error_log)
sudo /usr/local/apache2/bin/apachectl start

well, this worked for me on 10.3 and 10.4
hope it helps
Frank

Afternoon wrote:
> On 1 Dec 2005, at 15:24, Paolo wrote:
>
> > Hi Afternoon, not only I have restarted Apache after building
> > mod_python (3.1.4), I also have updated it from version 2.0.54 to
> > 2.0.55, but nothing has changed.
>
> Hang on, it's coming back to me now (sorry, it was a long night).
>
> What platform are you building on? Where is your Python? I had to
> define PYTHONHOME = /usr/ in envopts for Apache because I'm running
> OS X and my Python is stock but my Apache comes from the Fink project.
>
> Is there any way that Apache might not be able to find Python such as
> this?
>
> ________________________________
> Afternoon, man about the Internet --http://aftnn.org/

Offline

#9 Dec. 2, 2005 13:45:46

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


2005/12/1, Afternoon <>:
> Have you tried adding PythonDebug On to your httpd.conf? Also, I'm
> using SetHandler python-program, no idea if that makes any difference
> though.

Yes, PythonDebug is On, and to increase verbosity LogLevel is set to
value debug.

For mod_python 3.1, it is preferred to use mod_python, as
python-program is the old name (that is still supported). With
mod_python 2.7 instead it is mandatory to use python-program.

Offline

#10 Dec. 2, 2005 13:56:14

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Help running Django with mod_python


2005/12/1, Bryan Murdock <>:

> Do you have mod_php running too? See this:
>
>http://www.modpython.org/pipermail/mod_python/2004-January/014886.htmlNo mod_php installed! I already checked that (and this faq gives an
explanation about mod_php and mod_python incompatibilities in some
circumstances,http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp)

>
> Bryan

Thanks

Offline

Board footer

Moderator control

Enjoy the 22nd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support