On 27 March 2010 05:56, David <[email protected]> wrote: > Yes, mod_python is also compiled against Python 2.6 > > Here are the outputs: > > ls -las /usr/lib/libpython* > 0 lrwxrwxrwx 1 root root 19 Sep 24 2009 /usr/lib/ > libpython2.4.so -> libpython2.4.so.1.0 > 1120 -r-xr-xr-x 1 root root 1140304 Jun 11 2009 /usr/lib/ > libpython2.4.so.1.0 > 0 lrwxrwxrwx 1 root root 28 Jan 18 07:26 /usr/lib/ > libpython2.6.so -> /usr/lib/libpython2.6.so.1.0 > 0 lrwxrwxrwx 1 root root 38 Jan 18 07:26 /usr/lib/ > libpython2.6.so.1.0 -> /opt/python2.6/lib/libpython2.6.so.1.0 > > > ldd /usr/lib/httpd/modules/mod_python.so > linux-gate.so.1 => (0x00905000) > libpthread.so.0 => /lib/libpthread.so.0 (0x00d97000) > libdl.so.2 => /lib/libdl.so.2 (0x00408000) > libutil.so.1 => /lib/libutil.so.1 (0x00110000) > libm.so.6 => /lib/libm.so.6 (0x00d52000) > libc.so.6 => /lib/libc.so.6 (0x0040c000) > /lib/ld-linux.so.2 (0x0039a000)
That is you problem. As documented in: http://code.google.com/p/modwsgi/wiki/InstallationIssues#Using_ModPython_and_ModWsgi If you are loading both mod_python and mod_wsgi at the same time, they MUST both be linked against shared library for Python. Your mod_python.so is linked statically and that can cause all sorts of strange problems. Graham > On Mar 25, 8:31 pm, Graham Dumpleton <[email protected]> > wrote: >> On 26 March 2010 15:19, David <[email protected]> wrote: >> >> > mod_python is loaded into the same Apache. Since there is better >> > support for mod_python on CentOS, the production version of the site >> > is on mod_python. Since mod_wsgi offers more advanced features >> > however, I'm trying to set up the feature testing site with mod_wsgi. >> > Are mod_python and mod_wsgi incompatible with each other? >> >> > The system's Python is version 2.4 >> >> What does ldd on mod_python.so yield? Is it also compiled against Python 2.6? >> >> > Do you still need the output of "ls -las /usr/lib/libpython*"? >> >> Very bit of information helps when I start suggesting things to do. >> >> Graham >> >> > David >> >> > On Mar 25, 6:15 pm, Graham Dumpleton <[email protected]> >> > wrote: >> >> Can you confirm that you don't also have mod_python being loaded into >> >> the same Apache? >> >> >> Is there a mod_python.so in modules directory for Apache? >> >> >> What is the version of Python installed as standard on system? >> >> >> Output from: >> >> >> ls -las /usr/lib/libpython* >> >> >> will tell me a bit more. >> >> >> Graham >> >> >> On 26 March 2010 08:12, David <[email protected]> wrote: >> >> >> > mod_wsgi was gotten from >> >> > wgethttp://modwsgi.googlecode.com/files/mod_wsgi-3.1.tar.gz >> >> >> > On Mar 25, 11:24 am, David <[email protected]> wrote: >> >> >> Doing so yields the error: >> >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] mod_wsgi >> >> >> (pid=21182): Exception occurred processing WSGI script '/data/hosting/ >> >> >> cubedev/apache/django.wsgi'. >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] Traceback (most >> >> >> recent call last): >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] File "/data/ >> >> >> hosting/cubedev/apache/django.wsgi", line 4, in application >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] from >> >> >> _functools import partial, reduce >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] SystemError: >> >> >> dynamic module not initialized properly >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] mod_wsgi >> >> >> (pid=21182): Exception occurred processing WSGI script '/data/hosting/ >> >> >> cubedev/apache/django.wsgi'. >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] Traceback (most >> >> >> recent call last): >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] File "/data/ >> >> >> hosting/cubedev/apache/django.wsgi", line 4, in application >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] from >> >> >> _functools import partial, reduce >> >> >> [Tue Mar 23 20:51:51 2010] [error] [client 10.1.0.251] SystemError: >> >> >> dynamic module not initialized properly >> >> >> >> Here are some details on my setup in case that is useful: >> >> >> >> 1. mod_wsgi version: 3.1 compiled from source (where was the source >> >> >> from?) >> >> >> 2. Python version: 2.6, compiled separate from CentOS system >> >> >> distribution as follows: >> >> >> >> wgethttp://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz >> >> >> tar xvfz Python-2.6.4.tgz >> >> >> cd Python-2.6.4 >> >> >> ./configure --prefix=/opt/python2.6 --with-threads --enable-shared >> >> >> make >> >> >> make install >> >> >> ln -s /opt/python2.6/bin/python /usr/bin/python2.6 >> >> >> ln -s /opt/python2.6/lib/libpython2.6.so.1.0 /usr/lib/libpython2.6.so. >> >> >> 1.0 >> >> >> ln -s /usr/lib/libpython2.6.so.1.0 /usr/lib/libpython2.6.so >> >> >> >> 3. Apache version: 2.2.3 >> >> >> 4. OS: CentOS 5 >> >> >> 5. Django 1.1.1 >> >> >> 6. mod_wsgi config: VHost shown above, and I also put "WSGIPythonHome / >> >> >> opt/python2.6" in /etc/httpd/conf.d/wsgi.conf >> >> >> >> On Mar 23, 4:55 pm, Graham Dumpleton <[email protected]> >> >> >> wrote: >> >> >> >> > On 24 March 2010 11:43, David <[email protected]> wrote: >> >> >> >> > > I'm running CentOS 5, and am trying to get a django application >> >> >> > > working with mod_wsgi. I'm using .wsgi settings I got working on >> >> >> > > Ubuntu. I'm also using an alternate installation of python (/opt/ >> >> >> > > python2.6/) since my django application needs >2.5 and the OS uses >> >> >> > > 2.3 >> >> >> >> > > Here is the error: >> >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] SystemError: >> >> >> > > dynamic module not initialized properly >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] mod_wsgi >> >> >> > > (pid=23630): Target WSGI script '/data/hosting/cubedev/apache/ >> >> >> > > django.wsgi' cannot be loaded as Python module. >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] mod_wsgi >> >> >> > > (pid=23630): Exception occurred processing WSGI script >> >> >> > > '/data/hosting/ >> >> >> > > cubedev/apache/django.wsgi'. >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] Traceback >> >> >> > > (most >> >> >> > > recent call last): >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File >> >> >> > > "/data/ >> >> >> > > hosting/cubedev/apache/django.wsgi", line 8, in >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] import >> >> >> > > django.core.handlers.wsgi >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/opt/ >> >> >> > > python2.6/lib/python2.6/site-packages/django/core/handlers/wsgi.py", >> >> >> > > line 1, in >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] from >> >> >> > > threading import Lock >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/opt/ >> >> >> > > python2.6/lib/python2.6/threading.py", line 13, in >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] from >> >> >> > > functools import wraps >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] File "/opt/ >> >> >> > > python2.6/lib/python2.6/functools.py", line 10, in >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] from >> >> >> > > _functools import partial, reduce >> >> >> > > [Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251] SystemError: >> >> >> > > dynamic module not initialized properly >> >> >> >> > > And here is my .wsgi file: >> >> >> >> > > import os >> >> >> > > import sys >> >> >> > > os.environ['PYTHON_EGG_CACHE'] = '/tmp/django/' # This line was >> >> >> > > added >> >> >> > > for CentOS. >> >> >> > > os.environ['DJANGO_SETTINGS_MODULE'] = 'cube.settings' >> >> >> >> > > sys.path.append('/data/hosting/cubedev') >> >> >> >> > > import django.core.handlers.wsgi >> >> >> > > application = django.core.handlers.wsgi.WSGIHandler() >> >> >> >> > Can you cut Django out of the picture by instead using WSGI script >> >> >> > file of: >> >> >> >> > def application(environ, start_response): >> >> >> > status = '200 OK' >> >> >> > output = 'Hello World!' >> >> >> >> > from _functools import partial, reduce >> >> >> >> > response_headers = [('Content-type', 'text/plain'), >> >> >> > ('Content-Length', str(len(output)))] >> >> >> > start_response(status, response_headers) >> >> >> >> > return [output] >> >> >> >> > This will perform import within context of request handler. >> >> >> >> > Graham >> >> >> >> > > output of ldd /usr/lib/httpd/modules/mod_wsgi.so: >> >> >> >> > > linux-gate.so.1 => (0x00250000) >> >> >> > > libpython2.6.so.1.0 => /opt/python2.6/lib/libpython2.6.so.1.0 >> >> >> > > (0x00be6000) >> >> >> > > libpthread.so.0 => /lib/libpthread.so.0 (0x00110000) >> >> >> > > libdl.so.2 => /lib/libdl.so.2 (0x00557000) >> >> >> > > libutil.so.1 => /lib/libutil.so.1 (0x00128000) >> >> >> > > libm.so.6 => /lib/libm.so.6 (0x0012c000) >> >> >> > > libc.so.6 => /lib/libc.so.6 (0x00251000) >> >> >> > > /lib/ld-linux.so.2 (0x0039a000) >> >> >> >> > > vhost config: >> >> >> >> > > <VirtualHost *:80> >> >> >> > > ServerAdmin [email protected] >> >> >> > > ServerAlias cube-dev.example.com >> >> >> > > ServerName cube-dev.example.com >> >> >> > > ErrorLog logs/cube-dev.example.com.error_log >> >> >> > > CustomLog logs/cube-dev.example.com.access_log common >> >> >> > > Alias /phpMyAdmin /var/www/phpMyAdmin/ >> >> >> > > # DocumentRoot /data/hosting/cubedev >> >> >> >> > > WSGIScriptAlias / /data/hosting/cubedev/apache/django.wsgi >> >> >> >> > > WSGIProcessGroup cubedev.example.com >> >> >> > > WSGIDaemonProcess cubedev.example.com >> >> >> >> > > Alias /media/ /data/hosting/cubedev/media/ >> >> >> > > Alias /adminmedia/ /opt/python2.6/lib/python2.6/site-packages/ >> >> >> > > django/contrib/admin/media/ >> >> >> > > Alias /media /data/hosting/cubedev/media >> >> >> >> > > <Directory "/data/hosting/cubedev/media"> >> >> >> > > Order deny,allow >> >> >> > > Allow from all >> >> >> > > </Directory> >> >> >> > > </VirtualHost> >> >> >> >> > > -- >> >> >> > > You received this message because you are subscribed to the Google >> >> >> > > Groups "modwsgi" group. >> >> >> > > To post to this group, send email to [email protected]. >> >> >> > > To unsubscribe from this group, send email to >> >> >> > > [email protected]. >> >> >> > > For more options, visit this group >> >> >> > > athttp://groups.google.com/group/modwsgi?hl=en. >> >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups "modwsgi" group. >> >> > To post to this group, send email to [email protected]. >> >> > To unsubscribe from this group, send email to >> >> > [email protected]. >> >> > For more options, visit this group >> >> > athttp://groups.google.com/group/modwsgi?hl=en. >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "modwsgi" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group >> > athttp://groups.google.com/group/modwsgi?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
