Django Syncdb Error

apps

#1

I’m getting the following error when I run the django-admin.py syncdb command for the first time. I set up Django using Jeff Croft’s guide and am stumped.

The error:

servername:django-admin.py syncdb
Traceback (most recent call last):
File “/home/mysite/django/django_src/django/bin/django-admin.py”, line 5, in ?
management.execute_from_command_line()
File “/home/mysite/django/django_src/django/core/management.py”, line 1571, in execute_from_command_line
action_mapping[action](int(options.verbosity), options.interactive)
File “/home/mysite/django/django_src/django/core/management.py”, line 486, in syncdb
from django.db import connection, transaction, models, get_creation_module
File “/home/mysite/django/django_src/django/db/init.py”, line 11, in ?
backend = import(‘django.db.backends.%s.base’ % settings.DATABASE_ENGINE, {}, {}, [’’])
File “/home/mysite/django/django_src/django/db/backends/mysql/base.py”, line 20, in ?
raise ImportError, “MySQLdb-1.2.1p2 or newer is required; you have %s” % Database.version
ImportError: MySQLdb-1.2.1p2 or newer is required; you have 1.2.1g3

I would appreciate it if anyone could help out.

Thanks in advance,
Rich


#2

Hi Rich,
While I still haven’t got Django up and running while using the Wiki and Jeff Crofts guide I did run across this error and was able to get around it.

The problem is that the python version of MySQLdb is old, so I installed the newer version directly. After that I had no issues with the syncdb.

To install I used the tutorial section on MySQLdb from
http://www.projectsycamore.org/Installing_on_Dreamhost
Just the MySQLdb section though, obviously the rest is not useful.

Best of luck,
Lee


#3

I tried that but still get the same error. I did get a 404 error on the wget link in the tutorial but downloaded and installed the latest version of MySQLdb.

Thanks


#4

Was the new MySQLdb in a location that python could get to, aka in the PYTHONPATH?

for example my mysqldb resides in lib/python2.6/site-packages and in the PYTHONPATH I have
export PYTHONPATH=$HOME/django/django_src:$HOME/django/django_projects:$HOME/lib/python2.6/site-packages:$PYTHONPATH


#5

I updated the PYTHONPATH and was able to run the syncdb but when I tried to hit my subdomain I received the same error about the MySQLdb version.

I did a Google search and found this link: http://www.nabble.com/MySQLdb-version-t3434399.html

I checked out the latest version of Django (ver 4828) and now it works.

Thanks for the help and I hope this helps others.

Rich