问题描述

Django项目启动,当我们执行命令 python manage.py makemigrations 出现如下错误:

  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/operations.py", line , in last_executed_query
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'

解决办法

顺着报错信息,找到报错的位置,把

query = query.decode(errors='replace') 修改成 query = query.encode(errors='replace')
 

Django项目与mysql交互进行数据迁移时报错:AttributeError: 'str' object has no attribute 'decode'的更多相关文章

  1. zc.buildout构建项目时报错‘AttributeError: '_NamespacePath' object has no attribute 'sort'’

    在使用zc.buildout构建项目时如果碰到‘AttributeError: '_NamespacePath' object has no attribute 'sort'’报错: An inter ...

  2. django 连接MYSQL时,数据迁移时报:django.db.utils.InternalError: (1366, "Incorrect string value: '\\xE9\\x97\\xAE\\xE9\\xA2\\x98' for column 'name' at row 5")

    django 连接MYSQL时,数据迁移时报:django.db.utils.InternalError: (1366, "Incorrect string value: '\\xE9\\x ...

  3. Django 运行报异常:AttributeError: 'str' object has no attribute 'get'

    Technorati Tags: Python,Django,Web 在使用django.contrib.auth用户机制进行用户的验证.登录.注销操作时,遇到这个异常. 首先是写了一个登录的视图,要 ...

  4. peewee insert 数据时报错:'buffer' object has no attribute 'translate'

    错误信息: "'buffer' object has no attribute 'translate'" 场景:使用peewee insert 数据时,BlobField 字段存储 ...

  5. MySQL Cluster导入数据表时报错:Got error 708 'No more attribute metadata records (increase MaxNoOfAttributes)' from NDBCLUSTER

    准备把以前的非集群版MySQL数据导入到MySQL Cluster中,出现 'No more attribute metadata records (increase MaxNoOfAttribute ...

  6. Django: AttributeError: 'str' object has no attribute 'resolve'

    再次重温Django的时候,遇到了这个错误.看了页面上,没啥有用的信息.遂谷歌一下,原来是一个很低级的错误:It's because you forgot to type the word " ...

  7. 搭建django项目连接mysql数据库环境

    开通博客园这么久,即将写下第一篇博客,十分兴奋.首先了,庆祝自己写下了码农生涯博客园第一篇博客,其次了,庆祝自己经过了10个小时奋战,终于成功搭建django项目连接mysql数据库的环境.在此过程中 ...

  8. vs2015 mvc项目数据迁移报错

    第一次做个mvc项目玩玩,然后需要数据迁移,也没做过,就百度找怎么数据迁移, 找到的方法是: 如果数据是在类库项目里就在‘程序包管理控制台’输入:enable-migrations -ContextT ...

  9. 项目案例之GitLab的数据迁移

    项目案例之GitLab的数据迁移 链接:https://pan.baidu.com/s/1CgaEv12cwfbs5RxcNpxdAg 提取码:fytm 复制这段内容后打开百度网盘手机App,操作更方 ...

随机推荐

  1. 手动升级 Confluence - 开始升级之前

    在本指南中,我们将会帮助你使用 zip / tar.gz 文件将你的 Confluence 安装实例在 Windows 或者 Linux 版本中升级到最新的版本. 升级到任何最新的版本都是免费的,如果 ...

  2. 51 Nod 1486 大大走格子

    1486 大大走格子  题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 160 难度:6级算法题  收藏  关注 有一个h行w列的棋盘,里面有一些格子是不 ...

  3. 暑假集训 #3div2 C Sequence 数字找规律

    C. Sequence (64 Mb, 1 sec / test)Integer sequences are very interesting mathematical objects. Let us ...

  4. hdu 1208 Ignatius and the Princess III 划分数,dp

    题目 题意:给你一个数字n,求将其划分成若干个数字相加总共有多少种划分数: <span style="font-size:24px;">#include <ios ...

  5. 【转】HDU-6035-Colorful Tree

    转自http://blog.csdn.net/Bahuia/article/details/76141574 题意: 题目链接:http://acm.hdu.edu.cn/showproblem.ph ...

  6. 【Spark机器学习速成宝典】模型篇08保序回归【Isotonic Regression】(Python版)

    目录 保序回归原理 保序回归代码(Spark Python) 保序回归原理 待续... 返回目录 保序回归代码(Spark Python) 代码里数据:https://pan.baidu.com/s/ ...

  7. 一、基础篇--1.1Java基础-Object类中常见的方法,为什么wait notify会放在Object里边

    这是个设计相关的问题,它考察的是面试者对现有系统和一些普遍存在但看起来不合理的事物的看法.回答这些问题的时候,你要说明为什么把这些方法放在Object类里是有意义的,还有不把它放在Thread类里的原 ...

  8. BeanDefinition 解析流程【解析所有配置类】

    BeanDefinition 解析流程 BeanDefinition 解析入口:ConfigurationClassPostProcessor#postProcessBeanDefinitionReg ...

  9. EasyPHP(php集成环境)下载 v5.4.6官方安装版

    EasyPHP版本:12.1(32位) PHP版本:5.4.6 MYSQL版本:5.5.27 APACHE版本:2.4.2 下载地址请点击

  10. [Amazon] Program for Fibonacci numbers 斐波那契数列

    The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21 ...