当前位置:网站首页>Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')
Replace Django database with MySQL (attributeerror: 'STR' object has no attribute 'decode')
2022-07-02 06:02:00 【I'm not big head】
1. install
pip3 install pymsql2. Look for any one __init__ File plus the following code
import pymysql
pymysql.install_as_MySQLdb()
3. settings.py Configuration replacement
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysql',
'USER': 'root',
'PASSWORD': 'foobared',
'HOST': '106.14.42.253',
'PORT': 'xxx',
}
}4. If the following error is reported , Just modify the source code (django2.2x Replace above mysql Will report a mistake , normal )
AttributeError: 'str' object has no attribute 'decode'

5. terms of settlement

Then re execute the database synchronization instruction

边栏推荐
- token过期自动续费方案和实现
- STC8H8K系列匯編和C51實戰——數碼管顯示ADC、按鍵串口回複按鍵號與ADC數值
- STC8H8K系列汇编和C51实战——按键允许按键计数(利用下降沿中断控制)
- Problems encountered in uni app development (continuous update)
- PHP gets CPU usage, hard disk usage, and memory usage
- Style modification of Mui bottom navigation
- Stick to the big screen UI, finereport development diary
- JS determines whether the mobile terminal or the PC terminal
- 我所理解的DRM显示框架
- External interrupts cannot be accessed. Just delete the code and restore it Record this unexpected bug
猜你喜欢

Practice C language advanced address book design

uni-app开发中遇到的问题(持续更新)

CNN visualization technology -- detailed explanation of cam & grad cam and concise implementation of pytorch

Comment utiliser mitmproxy

Stick to the big screen UI, finereport development diary

Deep learning classification network -- alexnet

Oled12864 LCD screen

数据回放伴侣Rviz+plotjuggler

MySQL transaction and isolation level

Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond
随机推荐
Deep learning classification network -- alexnet
php读文件(读取json文件,转换为数组)
Web页面用户分步操作引导插件driver.js
Zabbix Server trapper 命令注入漏洞 (CVE-2017-2824)
复杂 json数据 js前台解析 详细步骤《案例:一》
Summary of MySQL constraints
PHP gets CPU usage, hard disk usage, and memory usage
Unity shader learning notes (3) URP rendering pipeline shaded PBR shader template (ASE optimized version)
1035 Password
servlet的web.xml配置详解(3.0)
Can't the dist packaged by vite be opened directly in the browser
c语言中的几个关键字
Lambda 表达式 和 方法引用
ROS2----LifecycleNode生命周期节点总结
Stc8h8k series assembly and C51 actual combat - keys allow key counting (using falling edge interrupt control)
借力 Google Cloud 基础设施和着陆区,构建企业级云原生卓越运营能力
Vscode paste image plugin saves image path settings
Software testing - concept
Redis key value database [advanced]
JS determines whether the mobile terminal or the PC terminal