Opened 14 years ago

Last modified 13 years ago

#14013 closed

'django.db.backends.postgresql_psycopg2' isn't an available database backend. (?!?!?) — at Version 1

Reported by: kessler.bm@… Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

I'm currently teaching myself Django.

So, I successfully installed

Operating System: Windows XP SP3 
Python: Version 2.7
Django: Revision 13446
Database: PostgreSQL 8.4
Postgre Driver:  psycopg2.2.2
LAMP: XAMPP (Apache Friends Edition)
Python Interface: mod_wsgi

I configured a virtual host for my Django project.

For the most part, everything is "playing well together".

However, when I try to use Django with the Apache server, I get an error which seems similar to "invalid" ticket #12730... except for I don't have deseb.

This is my errorlog:

[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1] mod_wsgi (pid=2968): Exception occurred processing WSGI script 'D:/education/python/FirstProject/mysite/django.wsgi'.
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1] Traceback (most recent call last):
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 241, in __call__
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     response = self.get_response(request)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py", line 141, in get_response
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py", line 165, in handle_uncaught_exception
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return debug.technical_500_response(request, *exc_info)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\views\\debug.py", line 58, in technical_500_response
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     html = reporter.get_traceback_html()
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\views\\debug.py", line 137, in get_traceback_html
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return t.render(c)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\__init__.py", line 173, in render
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return self._render(context)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\__init__.py", line 167, in _render
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return self.nodelist.render(context)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\__init__.py", line 796, in render
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     bits.append(self.render_node(node, context))
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\debug.py", line 72, in render_node
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     result = node.render(context)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\debug.py", line 89, in render
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     output = self.filter_expression.resolve(context)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\__init__.py", line 579, in resolve
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     new_obj = func(obj, *arg_vals)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\template\\defaultfilters.py", line 693, in date
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return format(value, arg)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\dateformat.py", line 281, in format
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return df.format(format_string)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\dateformat.py", line 30, in format
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     pieces.append(force_unicode(getattr(self, piece)()))
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\dateformat.py", line 187, in r
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return self.format('D, j M Y H:i:s O')
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\dateformat.py", line 30, in format
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     pieces.append(force_unicode(getattr(self, piece)()))
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\encoding.py", line 66, in force_unicode
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     s = unicode(s)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\functional.py", line 206, in __unicode_cast
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return self.__func(*self.__args, **self.__kw)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\translation\\__init__.py", line 55, in ugettext
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return real_ugettext(message)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\functional.py", line 55, in _curried
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\translation\\__init__.py", line 36, in delayed_loader
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return getattr(trans, real_name)(*args, **kwargs)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 276, in ugettext
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     return do_translate(message, 'ugettext')
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 266, in do_translate
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     _default = translation(settings.LANGUAGE_CODE)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 176, in translation
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     default_translation = _fetch(settings.LANGUAGE_CODE)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\translation\\trans_real.py", line 159, in _fetch
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     app = import_module(appname)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\utils\\importlib.py", line 35, in import_module
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     __import__(name)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\contrib\\admin\\__init__.py", line 1, in <module>
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\contrib\\admin\\helpers.py", line 1, in <module>
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     from django import forms
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\forms\\__init__.py", line 17, in <module>
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     from models import *
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\forms\\models.py", line 6, in <module>
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     from django.db import connections
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\db\\__init__.py", line 75, in <module>
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     connection = connections[DEFAULT_DB_ALIAS]
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\db\\utils.py", line 91, in __getitem__
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     backend = load_backend(db['ENGINE'])
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]   File "C:\\devtool\\Python27\\lib\\site-packages\\django\\db\\utils.py", line 49, in load_backend
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     raise ImproperlyConfigured(error_msg)
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend. 
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1] Try using django.db.backends.XXX, where XXX is one of:
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1]     'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Tue Jul 27 21:14:49 2010] [error] [client 127.0.0.1] Error was: cannot import name utils

I saw a suggestion (elsewhere on the web) that I might fix this if I downgrade psycopg2 to 2.0.14, but to even test this fix, I will also need to downgrade Python to 2.6 ... but so far as I can tell, the problem isn't with either of those since they are both working fine together with python manage.py runserver

Moreover, I have confirmed the problem isn't with my Apache configuration, since everything works fine if I replace Postgre with SQLite3

Change History (1)

comment:1 by Ramiro Morales, 14 years ago

Description: modified (diff)

Reformatted the description.

Next time please read the recommendations listed under Read this first section on the page you used to create the ticket. One of them read:

To include code snippets in the ticket description, surround them with curley braces ( code snippet ). Read more about formatting on the WikiFormatting page.

Note: See TracTickets for help on using tickets.
Back to Top