newbie: mysql backend "Error was: cannot import name conversions" with subversion build of django

580 views
Skip to first unread message

harijay

unread,
Jan 5, 2010, 2:38:40 AM1/5/10
to Django users
Hi I just started using the subversion build of django and mysql-
python with python 2.6.3
Both django (svn 12103) and _mysql (MySQLdb rev 635) work fine and can
be imported from the command line python without any error messages.
I created a new django testproject and then modified my settings.py to
use the mysql backend ( see DATABASE section below).

But when I start python manage.py runserver 8080 , I get an error
which I am reproducing here indicating that the backend was not
started.

Any ideas on what I need to change to have my django launch with the
mysql backend.
Thanks
harijay

The error I get is

^Chariharan-jayarams-macbook-pro-17:testdjnew hari$ python manage.py
runserver 8080
Validating models...
Unhandled exception in thread started by <function inner_run at
0x7a3670>
Traceback (most recent call last):
File "/Users/hari/djtrunk/django/core/management/commands/
runserver.py", line 48, in inner_run
self.validate(display_num_errors=True)
File "/Users/hari/djtrunk/django/core/management/base.py", line 249,
in validate
num_errors = get_validation_errors(s, app)
File "/Users/hari/djtrunk/django/core/management/validation.py",
line 22, in get_validation_errors
from django.db import models, connection
File "/Users/hari/djtrunk/django/db/__init__.py", line 74, in
<module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Users/hari/djtrunk/django/db/utils.py", line 75, in
__getitem__
backend = load_backend(db['ENGINE'])
File "/Users/hari/djtrunk/django/db/utils.py", line 37, in
load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured:
'django.db.backends.mysql' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2',
'sqlite3'
Error was: cannot import name conversions

My settings.py has nothing special after my new settings.py creation
other than the following database section:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mytestdb', # Or path to database
file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': 'mypass', # Not used with
sqlite3.
'HOST': '', # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for
default. Not used with sqlite3.
}
}


Marc Aymerich

unread,
Jan 5, 2010, 3:12:15 AM1/5/10
to django...@googlegroups.com
in   'ENGINE': just put 'mysql'

 
--

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



Russell Keith-Magee

unread,
Jan 5, 2010, 4:52:46 AM1/5/10
to django...@googlegroups.com

This is bad advice. Django trunk has changed the preferred way to
refer to database engines to a fully qualified path. The old short
name approach will still work, but is deprecated.

Yours,
Russ Magee %-)

Russell Keith-Magee

unread,
Jan 5, 2010, 5:01:26 AM1/5/10
to django...@googlegroups.com

I haven't seen this error before, but it sounds like there might be
something wrong (or incompatible) with your MySQLdb install.

You should be able to run the following at a Python prompt:

>>> from MySQLdb.converters import conversions

The error you are seeing suggests that this is not the case.

The fact that you report your MySQLdb install as 'rev 635' suggests
that you're using a development version of MySQLdb. Either MySQLdb has
introduced a backwards incompatibility, or your build is incomplete or
contains errors.

To confirm this, I would suggest using a production version of MySQLdb
- recent production releases are known to work.

If it turns out that there has been a backwards incompatible
regression in MySQLdb, we will need to address that when a formal
release that contains that change is made.

Yours,
Russ Magee %-)

harijay

unread,
Jan 5, 2010, 3:18:57 AM1/5/10
to Django users
I get the same error if I put just 'mysql'; in the ENGINE setting. So
the backend does not start if the 'ENGINE' filed has 'mysql' or
'django.db.backends.mysql'
So any ideas why this is the case

hari

On Jan 5, 1:12 pm, Marc Aymerich <glicer...@gmail.com> wrote:

> > django-users...@googlegroups.com<django-users%2Bunsubscribe@google groups.com>

harijay

unread,
Jan 5, 2010, 3:39:49 AM1/5/10
to Django users
I am sorry I get the same error even If I put the 'ENGINE':'mysql'
in the settings.py .

Hari

On Jan 5, 1:12 pm, Marc Aymerich <glicer...@gmail.com> wrote:

> > django-users...@googlegroups.com<django-users%2Bunsubscribe@google groups.com>

harijay

unread,
Jan 5, 2010, 7:36:55 AM1/5/10
to Django users
Thanks Russell Magee for your detailed and timely help.
I switched to the production version on MySQLdb and now I can run

from MySQLdb.converters import conversions

In the rev 635 I could not run this without getting an error.
So now I can start my server with the database settings and loading of
the MySQLdb module.
Thanks for the solution to my problem.

Hari


On Jan 5, 3:01 pm, Russell Keith-Magee <freakboy3...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages