Forums

No module named 'MySQLdb'

2015-01-20 12:21:15,396 :Traceback (most recent call last): 2015-01-20 12:21:15,397 : File "/usr/local/lib/python3.4/dist-packages/django/db/backends/mysql/base.py", line 14, in <module> 2015-01-20 12:21:15,397 : import MySQLdb as Database 2015-01-20 12:21:15,397 :ImportError: No module named 'MySQLdb' 2015-01-20 12:21:15,397 : 2015-01-20 12:21:15,397 :During handling of the above exception, another exception occurred: 2015-01-20 12:21:15,397 : 2015-01-20 12:21:15,397 :Traceback (most recent call last): 2015-01-20 12:21:15,397 : File "/bin/user_wsgi_wrapper.py", line 130, in call 2015-01-20 12:21:15,398 : self.error_log_file.logger.exception("Error running WSGI application") 2015-01-20 12:21:15,398 : File "/usr/lib/python3.4/logging/init.py", line 1296, in exception 2015-01-20 12:21:15,398 : self.error(msg, args, kwargs) 2015-01-20 12:21:15,398 : File "/usr/lib/python3.4/logging/init.py", line 1289, in error 2015-01-20 12:21:15,399 : self._log(ERROR, msg, args, kwargs) 2015-01-20 12:21:15,399 : File "/usr/lib/python3.4/logging/init.py", line 1395, in _log 2015-01-20 12:21:15,399 : self.handle(record) 2015-01-20 12:21:15,400 : File "/usr/lib/python3.4/logging/init.py", line 1404, in handle 2015-01-20 12:21:15,400 : if (not self.disabled) and self.filter(record): 2015-01-20 12:21:15,400 : File "/usr/lib/python3.4/logging/init.py", line 692, in filter 2015-01-20 12:21:15,400 : for f in self.filters: 2015-01-20 12:21:15,401 : File "/bin/user_wsgi_wrapper.py", line 122, in call 2015-01-20 12:21:15,401 : app_iterator = self.app(environ, start_response) 2015-01-20 12:21:15,401 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 187, in call 2015-01-20 12:21:15,401 : self.load_middleware() 2015-01-20 12:21:15,401 : File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 45, in load_middleware 2015-01-20 12:21:15,401 : mw_class = import_by_path(middleware_path) 2015-01-20 12:21:15,401 : File "/usr/local/lib/python3.4/dist-packages/django/utils/module_loading.py", line 21, in import_by_path 2015-01-20 12:21:15,402 : module = import_module(module_path) 2015-01-20 12:21:15,402 : File "/usr/lib/python3.4/importlib/init.py", line 109, in import_module 2015-01-20 12:21:15,402 : return _bootstrap._gcd_import(name[level:], package, level) 2015-01-20 12:21:15,402 : File "<frozen importlib._bootstrap>", line 2231, in _gcd_import 2015-01-20 12:21:15,403 : File "<frozen importlib._bootstrap>", line 2214, in _find_and_load 2015-01-20 12:21:15,403 : File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked 2015-01-20 12:21:15,404 : File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked 2015-01-20 12:21:15,404 : File "<frozen importlib._bootstrap>", line 1129, in _exec 2015-01-20 12:21:15,404 : File "<frozen importlib._bootstrap>", line 1448, in exec_module 2015-01-20 12:21:15,404 : File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed 2015-01-20 12:21:15,404 : File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/middleware.py", line 3, in <module> 2015-01-20 12:21:15,405 : from django.contrib.auth.backends import RemoteUserBackend 2015-01-20 12:21:15,405 : File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/backends.py", line 3, in <module> 2015-01-20 12:21:15,405 : from django.contrib.auth.models import Permission 2015-01-20 12:21:15,405 : File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/models.py", line 48, in <module> 2015-01-20 12:21:15,405 : class Permission(models.Model): 2015-01-20 12:21:15,405 : File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py", line 96, in new 2015-01-20 12:21:15,405 : new_class.add_to_class('_meta', Options(meta, *kwargs)) 2015-01-20 12:21:15,405 : File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py", line 264, in add_to_class 2015-01-20 12:21:15,406 : value.contribute_to_class(cls, name) 2015-01-20 12:21:15,406 : File "/usr/local/lib/python3.4/dist-packages/django/db/models/options.py", line 124, in contribute_to_class 2015-01-20 12:21:15,406 : self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) 2015-01-20 12:21:15,406 : File "/usr/local/lib/python3.4/dist-packages/django/db/init.py", line 34, in getattr 2015-01-20 12:21:15,406 : return getattr(connections[DEFAULT_DB_ALIAS], item) 2015-01-20 12:21:15,406 : File "/usr/local/lib/python3.4/dist-packages/django/db/utils.py", line 198, in getitem 2015-01-20 12:21:15,407 : backend = load_backend(db['ENGINE']) 2015-01-20 12:21:15,407 : File "/usr/local/lib/python3.4/dist-packages/django/db/utils.py", line 113, in load_backend 2015-01-20 12:21:15,407 : return import_module('%s.base' % backend_name) 2015-01-20 12:21:15,407 : File "/usr/lib/python3.4/importlib/init.py", line 109, in import_module 2015-01-20 12:21:15,407 : return _bootstrap._gcd_import(name[level:], package, level) 2015-01-20 12:21:15,407 : File "/usr/local/lib/python3.4/dist-packages/django/db/backends/mysql/base.py", line 17, in <module> 2015-01-20 12:21:15,407 : raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) 2015-01-20 12:21:15,407 :django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'

all time i got this error message i does not understand why i have got this message but i have given 'syncdb' then this work fine and create all table but when i will hit my home page then this problem occur again please help me

Does this help? https://www.pythonanywhere.com/wiki/UsingMySQL

is there any solution for this?... It is happening to me right now

It is exactly my problem. I Sync the DB correctly and when i try to load my site raise the exception No Module Named 'MySQLdb'

Thank you for your answer

The solution is in the bottom of the link harry linked to.