On 28 June 2010 14:42, Mirror <[email protected]> wrote:
> my dajngo.wsgi
>
> import os
> import sys
>
> sys.path.append('/var/www/django')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
> os.environ['PYTHON_EGG_CACHE'] = '/var/www/django/myapp/.python-eggs'
>
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> -----------------------------------------------------------------------------------------------------------------------------------
>
> http.conf
>
> <VirtualHost 127.0.0.1:80>
>    DocumentRoot /var/www/default
>    ServerName localhost
>    WSGIScriptAlias /myapp /var/www/django/myapp/apache/django.wsgi
>    ErrorLog /var/www/django/myapp/logs/error_log
> </VirtualHost>
>
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> Apache error
>
> [Fri Jun 25 12:42:42 2010] [error] [client 127.0.0.1] File does not
> exist: /var/www/default/favicon.ico
> [Fri Jun 25 12:42:45 2010] [error] [client 127.0.0.1] File does not
> exist: /var/www/default/favicon.ico
> [Fri Jun 25 12:42:48 2010] [info] [client 127.0.0.1] mod_wsgi
> (pid=3585, process='', application='localhost|/myapp'): Loading WSGI
> script '/var/www/django/myapp/apache/django.wsgi'.
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1] mod_wsgi
> (pid=3585): Target WSGI script '/var/www/django/myapp/apache/
> django.wsgi' cannot be loaded as Python module.
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1] mod_wsgi
> (pid=3585): Exception occurred processing WSGI script '/var/www/django/
> myapp/apache/django.wsgi'.
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1] Traceback (most
> recent call last):
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]   File "/var/www/
> django/myapp/apache/django.wsgi", line 8, in <module>
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]     import
> django.core.handlers.wsgi
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]   File "/opt/
> python2.6/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
> line 1, in <module>
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]     from
> threading import Lock
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]   File "/opt/
> python2.6/lib/python2.6/threading.py", line 13, in <module>
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]     from
> functools import wraps
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]   File "/opt/
> python2.6/lib/python2.6/functools.py", line 10, in <module>
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1]     from
> _functools import partial, reduce
> [Fri Jun 25 12:42:48 2010] [error] [client 127.0.0.1] ImportError: /
> opt/python2.6/lib/python2.6/lib-dynload/_functools.so: failed to map
> segment from shared object: Permission denied
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> OUTPUT OF LDD
>
> linux-gate.so.1 =>  (0x0098c000)
>        libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0
> (0x00423000)
>        libpthread.so.0 => /lib/libpthread.so.0 (0x005cd000)
>        libdl.so.2 => /lib/libdl.so.2 (0x00110000)
>        libutil.so.1 => /lib/libutil.so.1 (0x006d8000)
>        libm.so.6 => /lib/libm.so.6 (0x00778000)
>        libc.so.6 => /lib/libc.so.6 (0x00a46000)
>        /lib/ld-linux.so.2 (0x002e5000)
> -----------------------------------------------------------------------------------------------------------------------------------
>
>
> tried this in wsgi file
>
>
>
>
> Hello world wsgi example is working fine
> but django is not
>
>
> import sys
> print >> sys.stderr,sys.prefix,sys.path
>
> def application(environ, start_response):
>    status = '200 OK'
>    output = 'Hello Worwwwwwld!'
>
>    response_headers = [('Content-type', 'text/plain'),
>                        ('Content-Length', str(len(output)))]
>    start_response(status, response_headers)
>
>    return [output]
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> got no error and apache error log said
>
> [Mon Jun 28 13:33:24 2010] [info] [client 127.0.0.1] mod_wsgi
> (pid=19384, process='', application='python.localhost|/application'):
> Loading WSGI script '/var/www/application/application.wsgi'.

Can you rebuild mod_wsgi from source code. This time do it as:

  make distclean
  ./configure --with-python=/opt/python2.6/bin/python2.6

  LD_RUN_PATH=/opt/python2.6/lib
  export LD_RUN_PATH

  make

  ldd .libs/mod_wsgi.so

  sudo make install

  unsetenv LD_RUN_PATH

The problem is possibly that when used mod_wsgi.so is resolving
against /usr/lib/libpython2.6.so.1.0 rather than
/opt/python2.6/lib/libpython2.6.so.1.0.

This can cause problems if using wrong Python library as not
necessarily compatible with extension modules used from installation.

Note, am assuming here that /usr/lib/libpython2.6.so is from a
different Python installation. I do find it a bit odd though that
still looking under /opt/python2.6 for other parts.

Anyway, lets resolve this issue first. You might perhaps explain how
many Python installations you have and where they all are.

Graham

-- 
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.

Reply via email to