No module named _mysql

438 views
Skip to first unread message

Sandeep kaur

unread,
Sep 16, 2015, 8:05:17 AM9/16/15
to django-users
Greetings,
I am using Python3.4 for the Django app on CentOs. The application is working perfectly fine with runserver, but when it is configured with apache and wsgi.py, I get this Internal Server error and error long says :

[Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177]   File "/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 27, in <module>
[Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177]     raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Wed Sep 16 11:38:30 2015] [error] [client 101.56.225.177] ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql


MySQLdb module is working perfectly fine. I tried to install MySQL-python and then found MySQLdb doesn't have Python 3 support. Then tried to used Python -mysql connector but that too gives error.

I don't know why the MySQL is not working with apache.
Your help will be highly appreciated.

--

Cliff Peng

unread,
Sep 16, 2015, 7:23:45 PM9/16/15
to django...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF66xG3jHPXhABeuq8Uw3UMV9vdPTg9PET5LdYSZZHY5sg8x1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Sandeep kaur

unread,
Sep 17, 2015, 1:35:11 AM9/17/15
to django-users

I have already implemented this solution, but still the error.log goes like this :

[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     from django.contrib.auth.models import Permission
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/contrib/auth/models.py", line 41, in <module>
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     class Permission(models.Model):
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/models/base.py", line 139, in __new__
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     new_class.add_to_class('_meta', Options(meta, **kwargs))
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/models/base.py", line 324, in add_to_class
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     value.contribute_to_class(cls, name)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/models/options.py", line 250, in contribute_to_class
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/__init__.py", line 36, in __getattr__
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     return getattr(connections[DEFAULT_DB_ALIAS], item)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 240, in __getitem__
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     backend = load_backend(db['ENGINE'])
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/utils.py", line 111, in load_backend
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     return import_module('%s.base' % backend_name)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     __import__(name)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]   File "/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 27, in <module>
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95]     raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Thu Sep 17 05:27:38 2015] [error] [client 123.239.71.95] ImproperlyConfigured: Error loading MySQLdb module: No module named _mysql
Reply all
Reply to author
Forward
0 new messages