See:

  
http://code.google.com/p/modwsgi/wiki/InstallationIssues#Multiple_Python_Versions
  http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonHome

Set:

  WSGIPythonHome /sw

Graham

2009/1/12 Alan <[email protected]>:
>
> Hi,
>
> I followed this issue (http://groups.google.com/group/modwsgi/
> browse_thread/thread/d5fb59eb82e59bd3/33bb41fb5c3517b1?
> lnk=gst&q=fink#33bb41fb5c3517b1) but it didn't help me much.
>
> I use Fink. I dowloaded modwsgi 2.3 and all seemed to be installed OK.
>
> mod_wsgi-2.3% ./configure
> checking for apxs2... no
> checking for apxs... /usr/sbin/apxs
> checking Apache version... 2.2.9
> checking for python... /sw/bin/python
> configure: creating ./config.status
> config.status: creating Makefile
>
> make
> /usr/sbin/apxs -c -I/sw/include/python2.5 -DNDEBUG  -Wc,'-arch i386'
> mod_wsgi.c -arch i386 -L/sw/lib/python2.5/config -lpython2.5 -ldl
> /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -
> DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/
> apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386 -I/sw/
> include/python2.5 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch
> mod_wsgi.slo
> /usr/share/apr-1/build-1/libtool --silent --mode=link gcc -o
> mod_wsgi.la  -rpath /usr/libexec/apache2 -module -avoid-version
> mod_wsgi.lo -arch i386 -L/sw/lib/python2.5/config -lpython2.5 -ldl
>
> I developed a project with django and now I am trying to test it with
> apache2 + mod_wsgi in my Mac.
>
> Starting apache I have:
> [Sun Jan 11 18:44:50 2009] [warn] Init: Session Cache is not
> configured [hint: SSLSessionCache]
> [Sun Jan 11 18:44:50 2009] [notice] Digest: generating secret for
> digest authentication ...
> [Sun Jan 11 18:44:50 2009] [notice] Digest: done
> [Sun Jan 11 18:44:50 2009] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9
> OpenSSL/0.9.7l DAV/2 mod_wsgi/2.3 Python/2.5.2 configured -- resuming
> normal operations
>
> Python 2.5.2 is my Fink python (system python is 2.5.1). All sounded
> fine so far.
>
> However, when starting to test my django project, after many try and
> error I found out that the sys.path inside mod_wsgi was:
>
> sys.path: ['/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/
> python2.5/plat-darwin', '/usr/lib/python2.5/plat-mac', '/usr/lib/
> python2.5/plat-mac/lib-scriptpackages', '/usr/lib/python2.5/lib-tk', '/
> usr/lib/python2.5/lib-dynload', '/Library/Python/2.5/site-packages']
>
> Clearly not related to fink python (/sw/bin/python, /sw/lib/
> python2.5). Reading as much as I could about mod_wsgi I came out with
> python-path option in my httpd.conf:
>
> WSGIDaemonProcess webapps user=alan group=staff processes=1 threads=16
> \
>         python-path=/sw/lib/python2.5:/sw/lib/python2.5/site-packages
>
> It allowed me to finaly see my initial web page application but it
> sounded a crappy solution, because my sys.path still has references to
> the wrong python:
>
> [['/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/
> plat-darwin', '/usr/lib/python2.5/plat-mac', '/usr/lib/python2.5/plat-
> mac/lib-scriptpackages', '/usr/lib/python2.5/lib-tk', '/usr/lib/
> python2.5/lib-dynload', '/Library/Python/2.5/site-packages', '/sw/lib/
> python2.5', '/sw/lib/python2.5/site-packages', '/sw/lib/python2.5/site-
> packages/Numeric', '/sw/lib/python2.5/site-packages/PIL', '/sw/lib/
> python2.5/site-packages/gtk-2.0', '/Users/alan/ccpnmr/ccpnmr2.0/
> python', '/Users/alan/workspace']
>
> And this "ghost" came to hunted me when I tried to use my web
> application (where I submit a tgz file) and I got this error (from
> django debug):
>
> Environment:
>
> Request Method: POST
> Request URL: http://192.168.2.4/ccpngrid/
> Django Version: 1.0.2 final
> Python Version: 2.5.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'webapps.ccpngrid',
>  'webapps.acpypi',
>  'django.contrib.admin',
>  'django.contrib.markup']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
>
> Traceback:
> File "/sw/lib/python2.5/site-packages/django/core/handlers/base.py" in
> get_response
>  86.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/sw/lib/python2.5/site-packages/django/contrib/auth/
> decorators.py" in __call__
>  67.             return self.view_func(request, *args, **kwargs)
> File "/Users/alan/workspace/webapps/../webapps/ccpngrid/views.py" in
> upload
>  15.         if form.is_valid():
> File "/sw/lib/python2.5/site-packages/django/forms/forms.py" in
> is_valid
>  120.         return self.is_bound and not bool(self.errors)
> File "/sw/lib/python2.5/site-packages/django/forms/forms.py" in
> _get_errors
>  111.             self.full_clean()
> File "/sw/lib/python2.5/site-packages/django/forms/forms.py" in
> full_clean
>  234.                     value = getattr(self, 'clean_%s' % name)()
> File "/Users/alan/workspace/webapps/../webapps/ccpngrid/models.py" in
> clean_file
>  48.                 tarfile.open(fileobj=file)
> File "/usr/lib/python2.5/tarfile.py" in open
>  1139.                     return func(name, "r", fileobj)
> File "/usr/lib/python2.5/tarfile.py" in gzopen
>  1204.                 gzip.GzipFile(name, mode, compresslevel,
> fileobj))
> File "/usr/lib/python2.5/tarfile.py" in taropen
>  1183.         return cls(name, mode, fileobj)
> File "/usr/lib/python2.5/tarfile.py" in __init__
>  1047.         self.name = os.path.abspath(name)
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/posixpath.py" in abspath
>  402.     if not isabs(path):
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/posixpath.py" in isabs
>  49.     return s.startswith('/')
>
> Exception Type: AttributeError at /ccpngrid/
> Exception Value: 'NoneType' object has no attribute 'startswith'
>
> If one follows this log one will note that at line 48 it changed from
> one python lib (fink 2.5.2) to another (system 2.5.1) and try to use
> system's tarfile module instead of fink's tarfile module and that's
> why I have the error in the end.
>
> By the way one of the reasons of using Fink Python instead of System
> Python is that tarfile module in System Python is buggy.
>
> Of course, I can try to reorder my sys.path list, but frankley,
> although it may work it still does not sound a conclusive solution.
>
> So bottom line, how in heavens can change and assure that when apache2
> + mod_wsgi starts they will use only and just only Fink's python with
> its only and just only libs ?
>
> Any help here would be more than appreciated.
>
> Many thanks in advance.
>
> Cheers,
> Alan
>
> >
>

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