1. The error information reported when running the project is as follows: File "/home/pyvip/.virtualenvs/myblog/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 36, in <module> raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__) django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3. The mysql version is too low, enter /home/pyvip/.virtualenvs/myblog/lib/python3.6/site- packages/django/db/backends/mysql/base.py, open it with vim Lines 35 and 36 need to be commented out, so that no errors will be reported due to the version. Enter wq in the last line mode to save and exit 2. Run the project again and report the following error File "/home/pyvip/.virtualenvs/myblog/lib/python3.6/site-packages/django/db/backends/mysql/operations.py", line 146, in last_executed_query query = query.decode(errors='replace') AttributeError: 'str' object has no attribute 'decode' Use vim to enter /home/pyvip/.virtualenvs/myblog/lib/python3.6/site-packages/django/db/backends/mysql/operations.py and change decode to encode in line 146. Run the project again at this time, and you can see that it runs successfully! ! ! Prove that the mysql database connection is successful! Summarize The above is the method of connecting Django 2.2 version to MySQL database introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Using Vue to implement timer function
>>: Use of Docker image storage overlayfs
Table of contents 1. Write an HTML, the first Vue...
Table of contents Environment Preparation start 1...
Table of contents 1. What is grub encryption 2. g...
Without further ado, let's take a look at the...
A vector wave <svg viewBox="0 0 560 20&qu...
Project requirements require some preprocessing o...
Understanding of polling In fact, the focus of po...
VUE uses vue-seamless-scroll to automatically scr...
Table of contents 1. Commonjs exports and require...
Script requirements: Back up the MySQL database e...
This article uses an example to describe how MySQ...
This article example shares the specific code of ...
1. Experimental description In the virtual machin...
Installation Steps 1. Install Redis Download the ...
Preface After MySQL version 3.23.44, InnoDB engin...