Re: Error in setting up psycopg2

2009-09-08 Thread Jan Ostrochovsky

Hi Simon,

I had also problems with psycopg2 on Mac OS X. First with development
server (python manage.py runserver), and when solved, later also with
Apache.

Finally I decided for Linux on production server (with Apache), and
let Mac OS X on development workstations (with runserver).

If such setup is suitable also for you, maybe these howtos will be
also useful:
http://sharpe-s-postgres.blogspot.com/2009/09/how-to-install-postgresql-module-for.html
http://sharpe-s-django.blogspot.com/2009/09/deployment-of-django-project-using.html

If you will need some support with Linux or PostgreSQL, do not
hesitate to contact me directly.

Jano

On Aug 25, 1:19 pm, Simon Lee  wrote:
> 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 
> [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 
> [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 
> [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 
> [Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]     raise
> ImproperlyConfigured("Error loadingpsycopg2module: %s" % e)
> [Tue Aug 25 19:12:24 2009] [error] [client 127.0.0.1]
> ImproperlyConfigured: Error loadingpsycopg2mod

Re: Error in setting up psycopg2

2009-08-26 Thread Thomas Guettler



Simon Lee schrieb:
> Hi Thomas,
...

> 
> 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"?
> 

Try to to install a new version von psycopg2, since it seems to be broken.

Try to use psycopg2 without django.

  Thomas

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



Re: Error in setting up psycopg2

2009-08-25 Thread Simon Lee
d:
_PQbackendPID"?

Simon

On Aug 25, 4:25 pm, Simon Lee  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 "", line 1, in   File 
> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packa 
> ges/django/contrib/sessions/backends/db.py", line 2, in     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     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     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  wrote:
>
> From: Thomas Guettler 
> Subject: Re: Error in setting up psycopg2
> To: "Simon Lee" , 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: 
> > 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
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-25 Thread Simon Lee
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 "", line 1, in   File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/sessions/backends/db.py",
 line 2, in     from django.contrib.sessions.models import 
Session  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/sessions/models.py",
 line 4, in     from django.db import models  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/__init__.py",
 line 10, in     if not settings.DATABASE_ENGINE:  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/utils/functional.py",
 line 269, in __getattr__    self._setup()  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/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  wrote:

From: Thomas Guettler 
Subject: Re: Error in setting up psycopg2
To: "Simon Lee" , 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: 
> 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
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-24 Thread Thomas Guettler

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



Re: Error in setting up psycopg2

2009-08-23 Thread Thomas Guettler

Hi Simon,



Simon Lee schrieb:
> Thank you for being patient in helping me out.
> 
> I checked it /etc/passwd and found this line which I think is the
> reference for UID 70
> 
> _www:*:70:70:World Wide Web Server:/Library/WebServer:/usr/bin/false
> 
> I did "su - _www" (I hope I did this right). It still asked for a
> password which I entered my root password (the only password that I
> know) and it complained that the password is wrong.

You seem to be a beginner with unix, too. That makes it more difficult,
but soon you will know the basics.

Unix user root can "su" to every account without password:

# get root:
u...@host> su -
r...@host> su - _www
w...@host>
Now you can check if this user can read the files:
more //tz.py


If this does not work. Maybe you need to change the last line in /etc/passwd
of user _www. /usr/bin/false means he has no login-shell. Change this
to /usr/bin/bash (or you preferred shell).

If you get "permission denied" while accessing the python files as www you need 
to run
"chmod -R a+rX  /..."

  Thomas

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



Re: Error in setting up psycopg2

2009-08-21 Thread Simon Lee

Thank you for being patient in helping me out.

I checked it /etc/passwd and found this line which I think is the
reference for UID 70

_www:*:70:70:World Wide Web Server:/Library/WebServer:/usr/bin/false

I did "su - _www" (I hope I did this right). It still asked for a
password which I entered my root password (the only password that I
know) and it complained that the password is wrong.

Please advise.

Simon

On Aug 22, 2:30 am, Randy Barlow  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Simon Lee declared:
>
> > Hi Thomas,
>
> > Ok, I put in the "assert False, os.getuid()". The error log logged the
> > following:
>
> > [Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1]     assert
> > False, os.getuid()
> > [Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] AssertionError:
> > 70
>
> > Then, I go the shell and entered "su - 70". It asked for the password.
> > I entered my root password, that's the only password that I set before
> > and the only password I know. But it said the password is wrong. I
> > cannot go any further as your advised. What should I do? I am not too
> > familiar with using Linux. Please help.
>
> The problem is that su wants a username and you are giving it a user id.
>  You can look in /etc/passwd to see what user has UID 70 and then su -
> .
>
> - --
> Randy Barlow
> Software Developer
> The American Research Institutehttp://americanri.com
> 919.228.4971
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAkqO58wACgkQw3vjPfF7QfVV7gCfTU3JLho3zVZ7viiHWJefkF6z
> o1wAnjgRLCGgNF4sGSL5d/iSyhMtph9/
> =hkaK
> -END PGP SIGNATURE-
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-21 Thread Randy Barlow

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Simon Lee declared:
> Hi Thomas,
> 
> Ok, I put in the "assert False, os.getuid()". The error log logged the
> following:
> 
> [Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] assert
> False, os.getuid()
> [Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] AssertionError:
> 70
> 
> Then, I go the shell and entered "su - 70". It asked for the password.
> I entered my root password, that's the only password that I set before
> and the only password I know. But it said the password is wrong. I
> cannot go any further as your advised. What should I do? I am not too
> familiar with using Linux. Please help.

The problem is that su wants a username and you are giving it a user id.
 You can look in /etc/passwd to see what user has UID 70 and then su -
.

- --
Randy Barlow
Software Developer
The American Research Institute
http://americanri.com
919.228.4971
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqO58wACgkQw3vjPfF7QfVV7gCfTU3JLho3zVZ7viiHWJefkF6z
o1wAnjgRLCGgNF4sGSL5d/iSyhMtph9/
=hkaK
-END PGP SIGNATURE-

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



Re: Error in setting up psycopg2

2009-08-21 Thread Simon Lee

Hi Thomas,

Ok, I put in the "assert False, os.getuid()". The error log logged the
following:

[Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] assert
False, os.getuid()
[Fri Aug 21 23:37:48 2009] [error] [client 127.0.0.1] AssertionError:
70

Then, I go the shell and entered "su - 70". It asked for the password.
I entered my root password, that's the only password that I set before
and the only password I know. But it said the password is wrong. I
cannot go any further as your advised. What should I do? I am not too
familiar with using Linux. Please help.

Simon

On Aug 21, 2:18 pm, Thomas Guettler  wrote:
> Hi Simon,
>
> it could be a permission problem:
>
> in the code do something like
>
> assert False, os.getuid().
>
> then on the shell, you need get this user:
> su - corresponding-user
> id # check if you have this UID
> #try to open the file:
> more /.../tz.py
>
> HTH,
>   Thomas
>
> Simon Lee schrieb:
>
> > 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.
>
> --
> 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
-~--~~~~--~~--~--~---



Re: Error in setting up psycopg2

2009-08-20 Thread Thomas Guettler

Hi Simon,

it could be a permission problem:

in the code do something like

assert False, os.getuid().

then on the shell, you need get this user:
su - corresponding-user
id # check if you have this UID
#try to open the file:
more /.../tz.py

HTH,
  Thomas

Simon Lee schrieb:
> 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.


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



Re: Error in setting up psycopg2

2009-08-20 Thread Simon Lee

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  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 
> > [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  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 +

Re: Error in setting up psycopg2

2009-08-20 Thread Thomas Guettler

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 
> [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  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 m

Re: Error in setting up psycopg2

2009-08-19 Thread Simon Lee

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



Re: Error in setting up psycopg2

2009-08-19 Thread Thomas Guettler

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

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