I am using windows 10 command line for a django project using python34 however, I am facing difficulties with SQL.
I have already installed mysqlclient using pip install mysqlclient==1.3.5
and located the file to make sure I was not delusional. I 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 questions like these already exist, but not one solution seems to have made any impact on attempts. Thank you in advance.
MySQLdb is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2. 0 and is built on top of the MySQL C API.
pip install pymysql
Then, edit the __init__.py file in your project origin dir(the same as settings.py)
add:
import pymysql pymysql.install_as_MySQLdb()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With