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
The display effects on IE, Fir...
1. Enter the configuration file of the yum source...
As shown in the figure: There are many files conne...
Install nginx Note that you must install nginx-fu...
Mysql5.5 dual machine hot standby Implementation ...
1. Use Canvas images as CSS background images The...
What Beautiful HTML Code Looks Like How to write ...
This article records the installation tutorial of...
download: Step 1: Open the website (enter the off...
mysql storage engine: The MySQL server adopts a m...
The project has been suspended recently, and the ...
Native js realizes the carousel effect (seamless ...
Preface If we want to achieve the effect of onlin...
There is a big difference between the writing ord...
Achieve results Code html <div class="css...