3
The problems seems to be related with the database connector you’re using.
My solution to this problem was using mysql-connector-c
instead of mysql-client
when connecting to the database.
I used this lib (mysqlclient 1.4.2.post1) to solve my issue but there is another option at the end.
Steps were:
pip install mysql-connector-python
pip install mysqlclient
- change the database settings in my settings file (base.py in my case)
- from
'default': env.db('DB_DEFAULT', default=f'mysql-connector://root:password@{HOST_MYSQL}:3306/YOUR_DB')
- to
'default': env.db('DB_DEFAULT', default=f'mysql://root:password@{HOST_MYSQL}:3306/YOUR_DB')
- from
Another option is changing the use_pure
from db options to true
, you can do it by adding the ?use_pure=True
querystring to you connection URL.
This last one could affect the connection performance because it assures that it will be made with Python’s pure connector and not the compile version of it.
2
If you use ‘mysql-connector-python’ Try using version 8.0.5 instead. I had the same issue when using the newest version of ‘mysql-connector-python’.
- [Django]-Django-allauth, recommendations for limiting failed login attempts
- [Django]-Where do I set environment variables on my Django Digital Ocean server?
- [Django]-Records getting deleted from Mysql table automatically
- [Django]-Where is Break button in Dell Inspiron 15R
0
don’t use:
order_dispatch_time = models.TimeField(default='00:00', max_length=100)
order_delivered_time = models.TimeField(default='00:00', max_length=100)
instead use :
import datetime
<...you model ...>
order_dispatch_time = models.TimeField(default=datetime.time(00,00))
order_delivered_time = models.TimeField(default=datetime.time(00,00))
- [Django]-Framework/Language for new web 2.0 sites (2008 and 2009)
- [Django]-Switch to Django Custom User Model, Groups and Permissions
- [Django]-Raw SQL query in Django
- [Django]-Build When Case query in for loop django
- [Django]-Django – how to do this with kwargs