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

前端 未结 2 1641
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 06:03

I am fresh to flask and was trying to build a blog on my own, and I ran into an issue with SQLite operation error. I have researched similar problem on Github and Stackoverf

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-29 06:30

    In your case, require to add following code into __init__.py:

    from models import User, Role
    
    @app.shell_context_processor
    def make_shell_context():
        return dict(db=db, User=User, Role=Role)
    

    then you do your previous works, it's all work.

提交回复
热议问题