Problems Connecting Django to MySQL

Asked 2 years ago, Updated 2 years ago, 47 views

Regarding the API Driver for Django and MySQL connections, Django Tutorial recommends mysqlclient among MySQLdb, mysqlclient, and MySQL Connector/Python, but MySQL Connector/Python is recommended on the MySQL site. What method do you recommend based on your development experience?

Please also give me a code example/sample code that connects Django and MySQL in the recommended way. Thank you.

django mysql python

2022-09-22 08:10

1 Answers

Based on the Python 3.4 Django version 1.9.5 window I use,

I applied the Mysql Connector/Python distributed by Oracle Mysql, but the migration did not work.

I don't know if it's just on my computer, but when I try to migrate, the correct datetime value error appears, and if I turn off the time zone on purpose and try to migrate, I'm having problems in other parts.

So I was using posgresql as psycopg2, but pgsql was a bit off Windows, so I connected maraidb to mysqlclient and changed it. There was no error before db

I recommend using mysqlclient for convenience

If you use mysqlclient, you can use django.db.backends.mysql as is


2022-09-22 08:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.