Answer the question
In order to leave comments, you need to log in
How to solve the problem when connecting MySQLdb to Django?
I need to use MySQL instead of sqlite. I wrote this in settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test',
'USER': 'root',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Answer the question
In order to leave comments, you need to log in
Try to install dev dependencies.
Also check if you are executing commands in the virtualenv ( is displayed before the input line)
I encountered the same on arch (python3.3, django 1.6, mariadb 5.5).
The following helped:
using PyMySQL, because Google suggested that mysql-python does not work with python3
Next, in the __init__.py of the application (INSTALLED_APPS), add:
import pymysql
pymysql.install_as_MySQLdb()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question