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
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.