tz.py is in the directory: "'/Library/Frameworks/Python.framework/
Versions/2.6/lib/python2.6/site-packages/psycopg2" which is in the
sys.path list. Why does the import still fail? Please advise.

Simon

On Aug 20, 4:37 pm, Thomas Guettler <h...@tbz-pariv.de> wrote:
> The important part: cannot import tz.
>
> Maybe you need to install it. I don't this module.
>
>   Thomas
>
> Simon Lee schrieb:
>
>
>
>
>
> > Hi Thomas,
>
> > Tried your method and modified /mysite3/apache/myapp.wsgi as followed:
>
> > import os, sys
> > sys.path.append('/Users/myname')
> > sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/django')
> > sys.path.append('/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/psycopg2')
>
> > try:
> >     import psycopg2 as Database
> > except ImportError, exc:
> >     import sys
> >     raise ImportError('%s %s' % (exc, sys.path))
>
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite3.settings'
> > import django.core.handlers.wsgi
> > application = django.core.handlers.wsgi.WSGIHandler()
>
> > --------
>
> > Now the error log is as followed:
>
> > [Wed Aug 19 23:58:54 2009] [info] [client 127.0.0.1] mod_wsgi
> > (pid=135, process='', application='www.test-mysite.com|'): Reloading
> > WSGI script '/Users/myname/mysite3/apache/myapp.wsgi'.
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=135): Target WSGI script '/Users/myname/mysite3/apache/
> > myapp.wsgi' cannot be loaded as Python module.
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=135): Exception occurred processing WSGI script '/Users/myname/
> > mysite3/apache/myapp.wsgi'.
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1]   File "/Users/
> > myname/mysite3/apache/myapp.wsgi", line 10, in <module>
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1]     raise
> > ImportError('%s %s' % (exc, sys.path))
> > [Wed Aug 19 23:58:54 2009] [error] [client 127.0.0.1] ImportError:
> > cannot import name tz ['/Library/Frameworks/Python.framework/Versions/
> > 2.6/lib/python26.zip', '/Library/Frameworks/Python.framework/Versions/
> > 2.6/lib/python2.6', '/Library/Frameworks/Python.framework/Versions/2.6/
> > lib/python2.6/plat-darwin', '/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/plat-mac', '/Library/Frameworks/
> > Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-
> > scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.6/
> > lib/python2.6/lib-tk', '/Library/Frameworks/Python.framework/Versions/
> > 2.6/lib/python2.6/lib-old', '/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/lib-dynload', '/Library/Frameworks/
> > Python.framework/Versions/2.6/lib/python2.6/site-packages', '/Users/
> > myname', '/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/django', '/Library/Frameworks/Python.framework/
> > Versions/2.6/lib/python2.6/site-packages/psycopg2']
>
> > --------
>
> > Any idea? Please advise. Thanks.
>
> > Simon
>
> > On Aug 19, 10:44 pm, Thomas Guettler <h...@tbz-pariv.de> wrote:
> >> Hi,
>
> >> you need to know what sys.path looks like. This is a list of
> >> searched directories.
>
> >> try:
> >>     import .... # Import lines that failes
> >> except ImportError, exc:
> >>     import sys
> >>     raise ImportError('%s %s' % (exc, sys.path))
>
> >> Then check if the stuff you want to import is on sys.path.
>
> >> Simon Lee schrieb:
>
> >>> I am trying to set up a simple test website in the Apache Server that
> >>> comes with OSX 10.5.8 and continuously ran into errors that
> >>> complainted about not able to import something in pscycopg2. The site
> >>> works if I ran with the django development server. When I port to
> >>> Apache, it did not work. Can someone tell me what I am missing?
> >>> ...
> >> ...
> >>> The following error was logged in my error log file:
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] mod_wsgi
> >>> (pid=120): Exception occurred processing WSGI script '/Users/myname/
> >>> mysite3/apache/myapp.wsgi'.
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] Traceback (most
> >>> recent call last):
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
> >>> myname/mysite3/django/core/handlers/wsgi.py", line 239, in __call__
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
> >>> myname/mysite3/django/core/handlers/base.py", line 67, in get_response
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1]   File "/Users/
> >>> myname/mysite3/django/contrib/sessions/middleware.py", line 9, in
> >>> process_request
> >>> [Wed Aug 19 11:00:26 2009] [error] [client 127.0.0.1] ImportError: No
> >>> module named db
> >> Here you will find your ImportError and sys.path.
>
> >> --
> >> Thomas Guettler,http://www.thomas-guettler.de/
> >> E-Mail: guettli (*) thomas-guettler + de
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to