I am working on a little hobby project which I want to publish under an open source license. I use the django framework 2.0 and I am now testing my application on the Apache web server. I use Anaconda3 to manage the virtual environment for the project. I already tested my application with SQLite as db backend, but if I use MySQL instead, the web server log says that mysqlclient can't import _mysql. I tried to run the dj development server on the python vm and it is working. Could you please help me?
Asked
Active
Viewed 55 times
1 Answers
1
Rather than using mysqlclient
, use pymysql. And in wsgi.py use this at top:
#wsgi.py
import os
...
import pymysql
pymysql.install_as_MySQLdb()
Reason for using pymysql
is: What's the difference between MySQLdb, mysqlclient and MySQL connector/Python?

ruddra
- 50,746
- 7
- 78
- 101