Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL-Python & Django 1.5.0: no module named mysql.base error
    text
    copied!<p>I am trying to create database table with Django by <code>python manage.py syncdb</code> and get an error <code>Error was: No module named mysql.base</code>. I know there are many questions like this on the web but none one of them helped me.</p> <p>Python version: <code>2.7.3 (default, Aug 1 2012, 05:16:07) \n[GCC 4.6.3]</code>.</p> <p>Django version: <code>(1, 5, 0, 'final', 0)</code>.</p> <p>MySQL-Python version: <code>MySQL_python-1.2.4b4-py2.7-linux-i686</code>.</p> <p>System information: <code>Linux Marlon 3.5.0-26-generic #42~precise1-Ubuntu SMP Mon Mar 11 22:19:42 UTC 2013 i686 athlon i386 GNU/Linux</code></p> <p>MySQL version: <code>mysql Ver 14.14 Distrib 5.5.29, for debian-linux-gnu (i686) using readline 6.2</code></p> <p>My <code>setting.py</code> file:</p> <pre><code>... DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'a', # Or path to database file if using sqlite3. # The following settings are not used with sqlite3: 'USER': 'a', 'PASSWORD': 'a', 'HOST': 'a', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '', # Set to empty string for default. } } ... </code></pre> <p>Error code:</p> <pre><code>`Traceback (most recent call last): File "manage.py", line 10, in &lt;module&gt; 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 &lt;module&gt; 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 &lt;module&gt; from django.db import models File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in &lt;module&gt; 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 45, 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: u'oracle', u'postgresql_psycopg2', u'sqlite3' Error was: No module named mysql.base` </code></pre> <p>And <code>import MySQLdb</code> works fine in the interactive shell. </p> <p>What am I doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload