Tuesday 6 January 2015

django.core.exceptions.improperlyconfigured error loading mysqldb module no module named mysqldb - Python Django MySQL Error

In order to deal massive (Big) data in one of my applications. I am testing MySQL with MariaDB and TokuDB. Previously I had used PostgreSQL for my applications but the Reporting Engine I am designing requires some unique features to update data faster and retrieve it in an efficient manner. TokuDB being based on Fractal Indexing makes the insertion faster for Bigger Data and keeps the database compressed resulting in efficient use of storage data. While running MySQL MariaDB with Django in my virtual environment, I encountered following error: 


 
django.core.exceptions.improperlyconfigured error loading mysqldb module no module named mysqldb
Full Trace is:
 
(django1.5)alis-air:DjangoMariaDb aliraza$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 8, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/core/management/sql.py", line 9, in <module>
    from django.db import models
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/db/utils.py", line 27, in load_backend
    return import_module('.base', backend_name)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/aliraza/Projects/VirtualEnv/django1.5/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

The solution to this error which worked for me was simply installing mysql-python module in my virtual environment. Use following command:
 
pip install mysql-python
and if you are not using virtualenv, then use:
 
sudo pip install mysql-python

1 comment:

  1. Most are, naturally, slot machines, however the web site additionally has desk games, together with reside versions in high definition, and helps mobile gaming too. These often have very low wagering circumstances although you can be restricted in selection for which slots you can to|you probably can} play. These days, Indian on-line casinos should try their 바카라 사이트 hardest to stand out from the gang.

    ReplyDelete