We are trying to use Django to connect to MySQL remote server.
There is a common error when connecting to an external MySQL database that even if you install in your environment all the mysql connectors, it will throw an error. This is the error:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you install mysqlclient?
In your enviroment, run
pip install pymysql
Then, edit the init.py file in your project origin dir(the same as settings.py)
import pymysql pymysql.install_as_MySQLdb()
Now try to connect again. If you get some weird error such as segmentation fault, check if you installed the connector via homebrew. The way they recommend to do it (which didn't work for me is this: https://github.com/PyMySQL/mysqlclient-python). If you installed that way via homebrew, just uninstall it (mysqlclient-python) and try to connect again.
Let me know if you have any questions below.