问题描述

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. Struts2笔记(学struts2只需要这一篇文章)

    1.如何将struts2框架引入到web项目中      1.把struts2相关jar包引入到项目中 2.把struts2的配置文件直接放到src下面,名字要叫做struts.xml.(运行时配置文 ...

  2. Linux安装并使用Ludwig训练模型

    一.在Python3环境安装Ludwig: 1.使用pip安装:pip install ludwig 2.源码编译安装: git clone git@github.com:uber/ludwig.gi ...

  3. JS框架_(coolShow.js)图片旋转动画特效

    百度云盘 传送门 密码:ble6 coolShow.js插件图片旋转动画效果 <!DOCTYPE HTML> <head> <meta http-equiv=" ...

  4. scala基础-1

    函数式编程 ​ 并行编程 ​ 多核计算.云计算 ​ 引用透明,给值确定,结果也确定 数据类型 三种变量修饰符 ​ val 定义immutable variable ​ var 定义mutable va ...

  5. linux下安装R第三方包forecast

    ERROR: [root@localhost soft]# R CMD INSTALL curl_3.1.tar.gz WARNING: ignoring environment value of R ...

  6. 超全详解Java开发环境搭建

    摘自:https://www.cnblogs.com/wangjiming/p/11278577.html 超全详解Java开发环境搭建   在项目产品开发中,开发环境搭建是软件开发的首要阶段,也是必 ...

  7. docker简单理解

    Docker是开源的一个基于轻量级虚拟化技术的容器引擎项目.它通过分层镜像标准化和内核虚拟化技术,使得应用开发者和运维工程师可以以统一的方式跨平台发布应用,并且以几乎没有额外开销的情况下提供资源隔离的 ...

  8. ASP.NET图片防盗链(使用一般处理程序)

    <img src="你的一般处理程序的地址"/> context.Response.ContentType = "image/jpeg"; Uri ...

  9. Entity Framework Code First使用者的福音 --- EF Power Tool使用记之一

    下次会为大家深入解析这个小工具.  最先看到这个工具是在EF产品组最新的博客文章上,http://blogs.msdn.com/b/adonet/archive/2011/05/18/ef-power ...

  10. leetcode-easy-dynamic-70 Climbing Stairs

    mycode  65% class Solution(object): def climbStairs(self, n): """ :type n: int :rtype ...