Error:flask_sqlalchemy

 

(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))

 

posted @ 2018-05-03 23:22  Adamanter  阅读(266)  评论(0编辑  收藏  举报