Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I'm using windows 10 command line for a django project using python34. However, I am facing difficulties with the SQL.

What I have installed is mysqlclient by using pip install mysqlclient==1.3.5 and located the file to make sure that I was not delusional. Thenafter then ran python manage.py migrate to migrate the tables to the SQL database (I am using phpmyadmin). However when the command returned with:

File "C:\Users\user\env\lib\site-packages\django\db\backends\mysql\base.py", line 30, in <module>
    'Did you install mysqlclient or MySQL-python?' % e
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'.
Did you install mysqlclient or MySQL-python?

I am aware that the questions like these already exist, but not one solution seems to have made any impact on the attempts. Thank you in advance. 

1 Answer

0 votes
by (12.7k points)

Execute the below code in cmd:

pip install pymysql

Then, you can edit __init__.py in your project origin dir (take the same as settings.py).

Add the following:

import pymysql

pymysql.install_as_MySQLdb()

 Interested in SQL ? Check out this SQL Certification by Intellipaat.

For more information visit :

Interested to learn more about Python? Come & join our Python course

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...