报错django.db.utils.DataError: (1406, "Data too long for column 'gender' at row 1")的解决办法

2023-11-06

参考解决方案

这里写图片描述

Traceback (most recent call last):
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\mysql\base.py", line 110, in execute
    return self.cursor.execute(query, args)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 166, in execute
    result = self._query(query)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 322, in _query
    conn.query(q)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1057, in _read_query_result
    result.read()
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1014, in _read_packet
    packet.check_error()
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.DataError: (1406, "Data too long for column 'gender' at row 1")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3.2\helpers\pycharm\django_manage.py", line 43, in <module>
    run_module(manage_file, None, '__main__', True)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:/Users/rHotD/Documents/GitHub/Online-education-platform-Imooc/MxOnline\manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 63, in execute
    return super(Command, self).execute(*args, **options)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\core\management\base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 183, in handle
    self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\models.py", line 168, in create_superuser
    return self._create_user(username, email, password, **extra_fields)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\models.py", line 151, in _create_user
    user.save(using=self._db)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\contrib\auth\base_user.py", line 80, in save
    super(AbstractBaseUser, self).save(*args, **kwargs)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 796, in save
    force_update=force_update, update_fields=update_fields)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 824, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 908, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\base.py", line 947, in _do_insert
    using=using, raw=raw)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\query.py", line 1045, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\models\sql\compiler.py", line 1054, in execute_sql
    cursor.execute(sql, params)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\utils\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "C:\Users\rHotD\AppData\Local\Programs\Python\Python35\lib\site-packages\django\db\backends\mysql\base.py", line 110, in execute
    return self.cursor.execute(query, args)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 166, in execute
    result = self._query(query)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\cursors.py", line 322, in _query
    conn.query(q)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 856, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1057, in _read_query_result
    result.read()
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1340, in read
    first_packet = self.connection._read_packet()
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 1014, in _read_packet
    packet.check_error()
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\connections.py", line 393, in check_error
    err.raise_mysql_exception(self._data)
  File "C:\Users\rHotD\AppData\Roaming\Python\Python35\site-packages\pymysql\err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
django.db.utils.DataError: (1406, "Data too long for column 'gender' at row 1")

经检查,此字段最大长度设置有误

这里写图片描述

修改一下:

这里写图片描述

这回好了

这里写图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

报错django.db.utils.DataError: (1406, "Data too long for column 'gender' at row 1")的解决办法 的相关文章

随机推荐

  • jQuery取得select选中的值

    jQuery取得select选中的值 本来以为jQuery select1 val 是取得选中的值 那么jQuery select1 text 就是取得的文本 这是不正确的 正确做法是 jQuery select1 option selec
  • Qt中的单例模式:实现一个单例的界面类

    文章目录 前言 一 什么是单例模式 二 单例模式的优缺点及使用场景 三 Qt中单例类的创建 四 单例类的使用 测试 总结 前言 本文主要讲述了使用加锁的懒汉式来实现单例 文中示例将一个界面类修改为单例类 并在主界面获取多次该类的实例来进行测
  • 统计一个字符串中大写字母字符,小写字母字符,数字字符出现的次数

    统计一个字符串中大写字母字符 小写字母字符 数字字符出现的次数 不考虑其他字符 1 需求 统计一个字符串中大写字母字符 小写字母字符 数字字符出现的次数 不考虑其他字符 举例 Hello123World 结果 大写字符 2个 小写字符 8个
  • IDEA中常用的插件

    目录 Free MyBatis plugin codehelper generator grep console Translation Alibaba Java Coding Guidelines CamelCase GenerateAl
  • unordered_map的哈希HASH重载——举例unordered_map与pair联合使用

    有些时候 为了图省力 我们没准会这样的调用一个函数 unordered map lt pair
  • 分子模拟—Ovito渲染案例教程

    heartsuit spadesuit 分子模拟 Ovito渲染案例教程 heartsuit
  • 利用Nodejs 构建 WEB服务器

    前言 Web 服务器一般指网站服务器 是指驻留于因特网上某种类型计算机的程序 可以 向浏览器等 Web 客户端提供文档 也可以放置网站文件 让全世界浏览 可以放置数据文件 让全世界下载 目前最主流的三个 Web 服务器是 Apache Ng
  • 运算放大器芯片输出扩流电路三例

    工作原理 图1所示为三种集成运算放大器输出电流扩展电路 图 a 为双极性扩展电路 图 b 图 c 为单极性扩展电路 在图1 a 所示电路中 当输出电压为正时 BG1管工作 BG2管截止 输出电压为负时 BG1管截止 BC2管工作 二极管D1
  • C、C++、C#、python、java编程—文件读取

    C资料 菜鸟教程 C语言中文网 C community C 资料 菜鸟教程 cplusplus C community C 资料 菜鸟教程 microsoftC 文档 python资料 菜鸟教程 python标准库 Java资料 菜鸟教程
  • Multisim14.0安装教程

    2 安装步骤 解压 打开 Multisim14 0 鼠标右击 NI Circuit Design Suite 14 0 exe 选择 以管理员身份运行 点击确定 选择文件的解压路径 最好不解压在C盘 安装完成删掉即可 然后点击 Unzip
  • 华为OD机试2023(JS,C++,JAVA,PYTHON)-服务器能耗统计

    本篇题解 服务器耗能 题目描述 服务器有三种运行状态 空载 单任务 多任务 每个 时间片 的能耗的分别为 1 1 1 3 3 3 4 4 4 每个任务由起始时间片和结束时间片定义运行时间 如果一个时间片只有一个任务需要执行 则服务器处于单任
  • 微信小程序的常见的面试题(总结)

    1 微信小程序有几个文件 WXML WeiXin Markup Language 是框架设计的一套标签语言 结合基础组件 事件系统 可以构建出页面的结构 内部主要是微信自己定义的一套组件 WXSS WeiXin Style Sheets 是
  • Qt实现IP输入框(模仿Windows系统中的IP输入框)

    本文章所用的代码整理自Qt实现IP输入框 qt中ip地址输入框 GreenArrowMan的博客 CSDN博客 感谢原作者分享 本代码在上述作者代码基础上做了如下修改 1 屏蔽中文输入法 2 修复原作者代码中输入框四周的黑色边线无法正常显示
  • 【安装问题】python安装weditor出现报错总结

    python安装weditor出现报错总结 问题描述 主要原因是公司使用的python2版本过老 由于不能随意升级python版本 只能在python2的基础上解决办法 有很多地方需要更新 总结命令如下 基本上试过一遍 问题就可以解决了 解
  • 深度学习源码小项目汇总-代码全

    demo仓库和视频演示 到此一游7758258的个人空间 哔哩哔哩 bilibili 卷积网路CNN分类的模型一般使用包括alexnet DenseNet DLA GoogleNet Mobilenet ResNet ResNeXt Shu
  • 财报解读:毛利持续改善,金山云正在“弯道超车”?

    一季度 云巨头们的表现持续稳健 依旧稳坐前排 而作为中小云代表的金山云也在5月23日发布了2023年一季度财报 盈利能力持续改善成为通篇最亮眼的一笔 随着AI大模型打开了新的 潘多拉魔盒 云市场也在发生着巨变 但AI能否成为云厂商打开盈利大
  • JavaScript实现经典消方块游戏

    操作方式 在游戏区域中任意位置滑动手势 点击屏幕下方的按钮 键盘WASD和 都可以操作 游戏动作 操作 方块向左移动 左划 按下蓝色键 左一 A 方块向右移动 右划 按下橙色键 右一 D 强制方块下落 下划 按下粉色键 左二 S 改变方块方
  • Learncpp___CH1

    You have to write a program once to know how you should have written it the first time Short answer You don t C is one p
  • HTML详解连载(3)

    HTML详解连载 3 专栏链接 link http t csdn cn xF0H3 下面进行专栏介绍 开始喽 表单 作用 使用场景 input标签基本使用 示例 type属性值以及说明 input标签占位文本 示例 注意 单选框 radio
  • 报错django.db.utils.DataError: (1406, "Data too long for column 'gender' at row 1")的解决办法

    参考解决方案 Traceback most recent call last File C Users rHotD AppData Local Programs Python Python35 lib site packages djang