Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

II'm new on django . I am using ubuntu 13.04

Although i created the databse through phpmyadmin and also entered the credentials in settings.py but when i typed in the console

python manage.py syncdb

i got this error

Traceback (most recent call last):

File "manage.py", line 10, in

execute_from_command_line(sys.argv)

File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 453, in execute_from_command_line

utility.execute()

File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 392, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 272, in fetch_command

klass = load_command_class(app_name, subcommand)

File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 77, in load_command_class

module = import_module('%s.management.commands.%s' % (app_name, name))

File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module

__import__(name)

File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 8, in

from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal

File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 9, in

from django.db import models

File "/usr/local/lib/python2.7/dist-packages/django/db/init.py", line 40, in

backend = load_backend(connection.settings_dict['ENGINE'])

File "/usr/local/lib/python2.7/dist-packages/django/db/init.py", line 34, in getattr

return getattr(connections[DEFAULT_DB_ALIAS], item)

File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in getitem

backend = load_backend(db['ENGINE'])

File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend

return import_module('.base', backend_name)

File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module

__import__(name)

File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 17, in

raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

i have tried giving extensions to db name in settings.py but it didn't work. Please suggest what to do. Thanks !

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Or you can do:

sudo apt-get install python-mysqldb
share|improve this answer

Do you have mysql installed in you virtual environment

Try

pip install MySQL-python
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.