views:

292

answers:

3

I've installed django/postgres on local django server and works fine. I'm trying to get Apache working. I've set up the mod_wsgi and was able to get a "Hello World", and restart Apache. I'm almost there, but when I bring up localhost/index.html I get this server error:

TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 
'django.db.backends.postgresql_psycopg2' isn't an available database 
backend. 
[Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] Try using 
django.db.backends.XXX, where XXX is one of: 
[Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1]     'dummy', 
'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3' 
[Thu Sep 02 13:46:30 2010] [error] [client 127.0.0.1] Error was: 
cannot import name utils 

Is it possible that mod_wsgi and the version psycopg are incompatible? Has anyone tried this type of setup? Thx. Jesse

A: 

Maybe this Ticket helps you:

or whatever it is worth, I have confirmed that if I downgrade python to 2.6 and then likewise downgrade mod_wsgi and psycopg2, Django will work with Postgres on Apache as expected

Andre Bossard
A: 

I downgraded to 2.6, mod_wsgi, psycopg2 and still get this error in apache log file. Do you know what it might indicate? Thx:

Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] File "C:\Python26\lib\site-packages\django\db\init.py", line 77, in [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] connection = connections[DEFAULT_DB_ALIAS] [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] File "C:\Python26\lib\site-packages\django\db\utils.py", line 91, in getitem [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] backend = load_backend(db['ENGINE']) [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] File "C:\Python26\lib\site-packages\django\db\utils.py", line 49, in load_backend [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] raise ImproperlyConfigured(error_msg) [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend. [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] Try using django.db.backends.XXX, where XXX is one of: [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3' [Fri Sep 03 12:17:41 2010] [error] [client 97.80.165.181] Error was: cannot import name utils

Jesse
A: 

The cause is in the file django/db/backends/postgresql_psycopg2/base.py, version 2.2.2, line number 9: from django.db import utils

But I still don't know how to fix this. There is a file django/db/utils.py, so it should work. And it works for the development server, after all. But not for Apache + mod_wsgi