Django setup problem when executing syncdb

31 views
Skip to first unread message

ches

unread,
Feb 28, 2009, 9:23:13 AM2/28/09
to Django users
Dear All,
I have install Python2.6,Django 1.0.2, I'm sure it is installed
ok,since there is no errors on "import django" from the
interpreter,however when executing syncdb, I got:

C:\Django\projects\documenti>manage.py syncdb
Traceback (most recent call last):
File "C:\Django\projects\documenti\manage.py", line 11, in <module>
execute_manager(settings)
File "C:\Python26\lib\site-packages\django\core\management
\__init__.py", line
340, in execute_manager
utility.execute()
File "C:\Python26\lib\site-packages\django\core\management
\__init__.py", line
295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python26\lib\site-packages\django\core\management\base.py",
line 192,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python26\lib\site-packages\django\core\management\base.py",
line 218,
in execute
self.validate()
File "C:\Python26\lib\site-packages\django\core\management\base.py",
line 246,
in validate
num_errors = get_validation_errors(s, app)
File "C:\Python26\lib\site-packages\django\core\management
\validation.py", lin
e 22, in get_validation_errors
from django.db import models, connection
File "C:\Python26\lib\site-packages\django\db\__init__.py", line 16,
in <modul
e>
backend = __import__('%s%s.base' % (_import_path,
settings.DATABASE_ENGINE),
{}, {}, [''])
File "C:\Python26\lib\site-packages\django\db\backends\mysql
\base.py", line 13
, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: No mo
dule named MySQLdb

Do you have an idea?

Kind Regards,
ches

Horst Gutmann

unread,
Feb 28, 2009, 11:14:43 AM2/28/09
to django...@googlegroups.com
As the error message already says: Your missing the MySQLdb module.
Depending on your system you should be looking for something like a
py26-mysql or python-mysql package or install it manually yourself :-)

-- Horst

AKK

unread,
Feb 28, 2009, 6:18:48 PM2/28/09
to Django users
If you have windows you may want to try this version

http://groups.google.com/group/django-users/msg/5b5f4dee148d0fc3

There wasn't an mysqldb module exe version available for python 2.6
when i looked a few weeks ago.
I installed that and its worked fine.

Andrew

vector9x

unread,
Mar 1, 2009, 3:21:34 AM3/1/09
to Django users
try with
python manage.py syncdb

instead of
manage.py syncdb

bvemu

unread,
Mar 2, 2009, 12:03:39 PM3/2/09
to Django users
Hi Ches

The issue is that you are using python version 2.6 for which there is
no support from the MySQLdb package
so you have to downgrade your python version to 2.5.4 and let your
PYTHONPATH point to that (for example I am using SLE 11.1 henceforth
placed the bin of python 2.5.4 in my /home/subramanyam/bin directory
and it worked )

Regards
Vemu

Karen Tracey

unread,
Mar 2, 2009, 12:34:00 PM3/2/09
to django...@googlegroups.com
On Mon, Mar 2, 2009 at 12:03 PM, bvemu <balu...@gmail.com> wrote:

Hi Ches

The issue is that you are using python version 2.6  for which there is
no  support from the MySQLdb package

This is not true.  A pointer to a binary of MySQLdb for Python 2.6 on Windows was posted a while ago, AKK referred to it earlier in this thread:

http://groups.google.com/group/django-users/msg/5b5f4dee148d0fc3

I have tried this (just a brief test, my "real" use of Django/MySQL is on Linux, not Windows) and it worked fine, excepting some Deprecation warnings for use of sets, but that is harmless.
 
Karen

bvemu

unread,
Mar 3, 2009, 2:30:18 AM3/3/09
to Django users
Hi All

I apologise for posting a wrong answer , thanks karen for correcting
it

btw is it also applicable on linux I have been searching for MySQLdb
for python 2.6 on linux and could not find it

Thanks
Vemu

On Mar 2, 10:34 pm, Karen Tracey <kmtra...@gmail.com> wrote:

bitra

unread,
Mar 6, 2009, 10:54:10 AM3/6/09
to Django users
Hi, I had the same problem with ches. I install mysql with Django
1.0.2 and given the same error message, but I was using Python 2.5.2.
Do I have to install mysqldb module for this Python version?

thanks,


On Mar 1, 6:18 am, AKK <AndrewKenyon...@gmail.com> wrote:
> If you have windows you may want to try this version
>
> http://groups.google.com/group/django-users/msg/5b5f4dee148d0fc3
>
> There wasn't an mysqldb module exe version available for python 2.6
> when i looked a few weeks ago.
> I installed that and its worked fine.
>
> Andrew
>
> On 28 Feb, 14:23, ches <vladislav.vladimi...@gmail.com> wrote:
>
> > Dear All,
> > I haveinstallPython2.6,Django 1.0.2, I'm sure it is installed
> > ok,since there is no errors on "import django" from the
> > interpreter,however when executingsyncdb, I got:

Karen Tracey

unread,
Mar 6, 2009, 11:05:03 AM3/6/09
to django...@googlegroups.com
On Fri, Mar 6, 2009 at 10:54 AM, bitra <bpo...@gmail.com> wrote:

Hi, I had the same problem with ches. I install mysql with Django
1.0.2 and given the same error message, but I was using Python 2.5.2.
Do I have to install mysqldb module for this Python version?

Yes.  You have to install a mysqldb built against Python 2.5 if you want to run with MySQL and any Python 2.5.x.   If you're on Windows (I don't know if the 'ches' you mention is an OS or an app or what) you can find Windows binaries for Python 2.4 and 2.5 here:

http://sourceforge.net/project/showfiles.php?group_id=22307&package_id=15775

Karen

bitra

unread,
Mar 6, 2009, 11:16:43 AM3/6/09
to Django users
Thanks Karen,
oops, I forgot to mention, yes I'm using Windows and had the same "No
module named Mysqldb" error message...

I'm checking the link you gave and I'll try it out.

Thanks again. :)


On Mar 6, 11:05 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> http://sourceforge.net/project/showfiles.php?group_id=22307&package_i...
>
> Karen

bitra

unread,
Mar 7, 2009, 12:01:08 AM3/7/09
to Django users
Thanks Karen, I tried the module and it works well. Now I can use
mysql as the database.
Thanks alot.

On Mar 6, 11:16 pm, bitra <bpoe...@gmail.com> wrote:
> Thanks Karen,
> oops, I forgot to mention, yes I'm using Windows and had the same "No
> module named Mysqldb" error message...
>
> I'm checking the link you gave and I'll try it out.
>
> Thanks again. :)
>
> On Mar 6, 11:05 pm, Karen Tracey <kmtra...@gmail.com> wrote:
>

kk

unread,
Mar 10, 2009, 1:54:32 AM3/10/09
to Django users
Hi Karen,

I'm having the same problem as ches and brita had. I downloaded the
link that you have given, but I'm unable to run as it is an
application. If you can guide me where to store that application and
how to run that, I will be glad. Also, for the DATABASEHOST in
settings do we need to give the path of mysql in our computer or can
we just mention localhost. Please, reply.

Thank you.
KK

On Mar 6, 12:05 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> http://sourceforge.net/project/showfiles.php?group_id=22307&package_i...
>
> Karen

Karen Tracey

unread,
Mar 10, 2009, 8:09:00 AM3/10/09
to django...@googlegroups.com
On Tue, Mar 10, 2009 at 1:54 AM, kk <k.krish...@gmail.com> wrote:

Hi Karen,

 I'm having the same problem as ches and brita had. I downloaded the
link that you have given, but I'm unable to run as it is an
application. If you can guide me where to store that application and
how to run that, I will be glad. Also, for the DATABASEHOST in
settings do we need to give the path of mysql in our computer or can
we just mention localhost. Please, reply.

I'm not sure what exactly you downloaded that you cannot run as an application.  The page I pointed to has five files for download: two are .egg files, one tar.gz, and two .exe.  You want to download the .exe that matches the level of Python you are running, so if you are running Python 2.5 you want to get MySQL-python-1.2.2.win32-py2.5.exe, alternatively if you are running Python 2.4 you want to get the one with py2.4 in its name.  Once you download it (put it anywhere you like) you run it once to install and all the needed files are copied to the Python installation tree.  You can then delete the file you downloaded.

As for the DATABASE_HOST setting, you can just leave it blank or set it to 'localhost'. 

Karen

Vince

unread,
Apr 21, 2009, 5:01:45 AM4/21/09
to Django users
In ubuntu, you'll need to install mysqldb package for python:

sudo apt-get install python-mysqldb

test by entering python interactive mode and importing the package
without errors:

$ python
$ import MySQLdb

case matters.

On Mar 10, 5:09 am, Karen Tracey <kmtra...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages