FLASK爬坑笔记

转自:http://www.cnblogs.com/teuton/p/6654891.html

  • BUG1

    ExtDeprecationWarning: Importing flask.ext.sqlalchemy is deprecated, use flask_sqlalchemy instead.
    .format(x=modname), ExtDeprecationWarning

    解决办法:
    此错误信息出现在对 flask 进行拓展时导入包的方式上

    错误:from flask.ext.script import Manager

    正确:from flask_script import Manager

  • BUG2

    TypeError: 'bool' object is not callable

    解决办法
    flask_login 0.3之后将authenticated从函数更改为属性
    把g.user.is_authenticated() 修改为g.user.is_authenticated

  • BUG3

    第三方模块登录(OPenid)登录出错

    Login requested for OpenID="https://me.yahoo.com", remember_me=False
    解决办法暂时没找到 改用本地登录

    原因:获得用户时出错

  • BUG4
    **IndentationError: unexpected indent **

    原因:可能是tab和空格没对齐的问题,需要检查下tab和空格

+BUG5

TypeError: Unicode-objects must be encoded before hashing

原因:未进行编码

  • BUG6

    jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'author'

    原因:user中post传参错误

  • BUG7
    sqlalchemy.exc.IntegrityError

    原因:数据库中的用户名不唯一

思考:为防止数据重复出现,在两个或者多线程/进程进行并行存取数据库时,怎么解决?

    • BUG8
      sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table

      原因:没有创建相应的数据库

posted @ 2017-09-15 15:57  追梦的独行者  阅读(455)  评论(0编辑  收藏  举报