Hello all,
I was hoping someone here might be able to help me figure out what is
wrong with my configuration. Here's my current setup:
Windows 7
Python 2.6.6
Psycopg2-2.3.1
Postgres 9.0
mod_wsgi-win32-ap22py26-3.3.so
Apache 2.2
Django 1.2
First off, I have Django functioning correctly with the dev server,
and can make a call to the database correctly. Now, I wanted to get
WSGI to work with Django. Also, I am able to get the Hello World WSGI
example found here (
http://code.google.com/p/modwsgi/wiki/
QuickConfigurationGuide) to work correctly within my Django project
and have it print out "Hello World".
Here's my Apache configuration
WSGIPythonHome "C:/Python"
<VirtualHost *:80>
ServerName
sng.dev.com
ServerAlias
sng.dev.com
LogLevel info
Alias /media/ C:/code/sng/media
<Directory C:/code/sng/media>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / "C:/code/sng/wsgi/django.wsgi"
<Directory C:/code/sng/wsgi/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Here's what I have in my django.wsgi file:
---------------
path = 'C:\code'
if path not in sys.path:
sys.path.append('C:\code')
path = 'C:\code'
if path not in sys.path:
sys.path.append('C:\code\sng')
os.environ['DJANGO_SETTINGS_MODULE'] = 'sng.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
---------------
Here's the error stack trace:
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] mod_wsgi
(pid=6308): Target WSGI script 'C:/code/sng/wsgi/django.wsgi' cannot
be loaded as Python module.
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] mod_wsgi
(pid=6308): Exception occurred processing WSGI script 'C:/code/sng/
wsgi/django.wsgi'.
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] File "C:/code/
sng/wsgi/django.wsgi", line 33, in <module>
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] import
django.db.backends.postgresql_psycopg2
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] File "C:\
\Python\\lib\\site-packages\\django\\db\\__init__.py", line 77, in
<module>
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] connection =
connections[DEFAULT_DB_ALIAS]
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] File "C:\
\Python\\lib\\site-packages\\django\\db\\utils.py", line 92, in
__getitem__
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] backend =
load_backend(db['ENGINE'])
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] File "C:\
\Python\\lib\\site-packages\\django\\db\\utils.py", line 50, in
load_backend
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] raise
ImproperlyConfigured(error_msg)
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1]
ImproperlyConfigured: 'django.db.backends.postgresql_psycopg2' isn't
an available database backend.
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] Try using
django.db.backends.XXX, where XXX is one of:
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] 'dummy',
'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Sun Jan 09 23:07:46 2011] [error] [client 127.0.0.1] Error was:
cannot import name utils