Hi Thomas,

I did a Google search and did as one suggestion:
$ export PYTHONPATH=$HOME/:$PYTHONPATH
$ export DJANGO_SETTINGS_MODULE=mysite3.settings
$ python
>>> from django.contrib.sessions.backends import db

It works with no error. The same thing works if I do "python manage.py
shell" without the export.

That does not solve my problem though. I changed myapp.wsgi to the
following:

----------

import os, sys
sys.path.append('/Users/simonlee')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite3.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

----------

It shows the following error in my log:

[Tue Aug 25 19:12:24 2009] [info] [client 127.0.0.1] mod_wsgi
(pid=170, process='', application='www.test-hago-group.com|'): Loading
WSGI script '/Users/simonlee/mysite3/apache/myapp.wsgi'.
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=170): Exception occurred processing WSGI script '/Users/simonlee/
mysite3/apache/myapp.wsgi'.
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/core/handlers/wsgi.py", line 241, in __call__
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     response =
self.get_response(request)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/core/handlers/base.py", line 73, in get_response
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     response =
middleware_method(request)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/contrib/sessions/middleware.py", line 10, in process_request
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     engine =
import_module(settings.SESSION_ENGINE)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/utils/importlib.py", line 35, in import_module
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     __import__
(name)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/contrib/sessions/backends/db.py", line 2, in <module>
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     from
django.contrib.sessions.models import Session
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/contrib/sessions/models.py", line 4, in <module>
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     from
django.db import models
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/db/__init__.py", line 41, in <module>
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     backend =
load_backend(settings.DATABASE_ENGINE)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/db/__init__.py", line 17, in load_backend
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     return
import_module('.base', 'django.db.backends.%s' % backend_name)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/utils/importlib.py", line 35, in import_module
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     __import__
(name)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   File "/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
django/db/backends/postgresql_psycopg2/base.py", line 22, in <module>
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     raise
ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]
ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Library/
Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   Referenced
from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
site-packages/psycopg2/_psycopg.so
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]   Expected in:
dynamic lookup
[Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]

-----------

I did a search on the web but found only two links on similar error
without any solution. Does anyone know what caused "Symbol not found:
_PQbackendPID"?

Simon

On Aug 25, 4:25 pm, Simon Lee <hago...@yahoo.com> wrote:
> Hi Thomas,
> When I typed the following into my python console as advised:>>> from 
> django.contrib.session.backends import db
>
> I got the following error:
> Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packa 
> ges/django/contrib/sessions/backends/db.py", line 2, in <module>    from 
> django.contrib.sessions.models import Session  File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packa 
> ges/django/contrib/sessions/models.py", line 4, in <module>    from django.db 
> import models  File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packa 
> ges/django/db/__init__.py", line 10, in <module>    if not 
> settings.DATABASE_ENGINE:  File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packa 
> ges/django/utils/functional.py", line 269, in __getattr__    
> self._setup()  File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packa 
> ges/django/conf/__init__.py", line 38, in _setup    raise 
> ImportError("Settings cannot be
>  imported, because environment variable %s is undefined." % 
> ENVIRONMENT_VARIABLE)ImportError: Settings cannot be imported, because 
> environment variable DJANGO_SETTINGS_MODULE is undefined.
> I searched "/Users/myname/mysite3/settings.py" for the variable 
> SESSION_ENGINE but it is not defined in that file. I don't know where 
> settings.SESSION_ENGINE is defined???
> Simon
>
> --- On Mon, 8/24/09, Thomas Guettler <h...@tbz-pariv.de> wrote:
>
> From: Thomas Guettler <h...@tbz-pariv.de>
> Subject: Re: Error in setting up psycopg2
> To: "Simon Lee" <hago...@yahoo.com>, django-users@googlegroups.com
> Date: Monday, August 24, 2009, 11:17 PM
>
> Hi Simon,
>
> your first traceback looked like this:
>
> [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
>
> My line 9 of middleware.py of sessions looks like this:
> engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
>
> What does your variable settings.SESSION_ENGINE look like?
>
> Is it 'django.contrib.sessions.backends.db'?
>
> Try to import this as www user:
> w...@host> python
>
> >>> from django.contrib.session.backends import db
>
> Does this work?
>
> Simon Lee schrieb:
>
> > You are right. I am a newbie on Linux, trying hard to learn it at the
> > same time with the other stuff.
>
> > I did the following in the shell:
>
> > macbook:~myname$ su
> > Password: <enter my root password>
> > sh-3.2# su - _www
> > sh-3.2# more /Library/Frameworks/Python.framework/Versions/2.6/lib/
> > python2.6/site-packages/psycopg2/tz.py
>
> > I can read the file with more. Seems that there is no problem on
> > permission. Please advise.
>
> --
> 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