博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Error:flask_sqlalchemy
阅读量:7101 次
发布时间:2019-06-28

本文共 1274 字,大约阅读时间需要 4 分钟。

 

(1)sqlalchemy.exc.DataError

DataError: (pymysql.err.DataError) (1406, u"Data too long for column 'img_url' at row 1") [SQL: u'INSERT INTO classification (title, img_title, img_url) VALUES (%(title)s, %(img_title)s, %(img_url)s)'] [parameters: {'img_title': 'img_0', 'img_url': '/Users/Alex/Desktop/shengyuan/static/img/bmp/diwen-011.bmp', 'title': 'calssification0'}]

我当初设置的字段太短,之后一直这个错误,删除数据库,修改字段大小,重新生成

(2)sqlalchemy.exc.InternalError

InternalError: (pymysql.err.InternalError) (1054, u"Unknown column 'img_title' in 'field list'") [SQL: u'INSERT INTO classification (title, img_title, img_url) VALUES (%(title)s, %(img_title)s, %(img_url)s)'] [parameters: {'img_title': 'img_0', 'img_url': '/Users/Alex/Desktop/shengyuan/static/img/bmp/\xe5\xba\x95\xe7\xba\xb9-025.bmp', 'title': 'calssification0'}]

数据库表类初始化不完全,注意汉字编码

 

(3)werkzeug.routing.BuildError

BuildError: Could not build url for endpoint 'uploaded_file' with values ['filename']. Did you mean 'helloapp.routes.uploaded_file' instead?return redirect(url_for('uploaded_file', filename=filename))

flask官方案例使用app.routes(),我使用bp.routes(),提示非常有用,把helloapp.routes.uploaded_file替换uploaded_file

redirect(url_for('helloapp.routes.uploaded_file', filename=filename))

 

转载于:https://www.cnblogs.com/adamans/articles/8988169.html

你可能感兴趣的文章
Boxing
查看>>
一起学Android之GridView
查看>>
HBase笔记5(诊断)
查看>>
poj2092
查看>>
简单几何(极角排序) POJ 2007 Scrambled Polygon
查看>>
轻院1064加密字符
查看>>
ajx 发送json串(Request Payload格式)
查看>>
工资管理系统可行性分析人员分工
查看>>
BZOJ3781:小B的询问——题解
查看>>
BZOJ4557:[JLOI2016/SHOI2016]侦察守卫——题解
查看>>
通过Ajax和SpringBoot交互的示例
查看>>
可重入函数与不可重入函数
查看>>
[转] 深入剖析 linux GCC 4.4 的 STL string
查看>>
常用Web Service汇总(天气预报、时刻表等)
查看>>
resin app server安装总结
查看>>
抓取新浪新闻列表实例
查看>>
[04-06]鼠标悬停图片时,实现抖动效果
查看>>
抽象类和接口的区别
查看>>
react 自定义 TabBar 组件
查看>>
Palindrome Pairs
查看>>