from app import create_app, db
|
|
from app.models import User
|
|
|
|
app = create_app()
|
|
|
|
|
|
@app.shell_context_processor
|
|
def make_shell_context():
|
|
"""
|
|
Make the following easily accessible from 'flask shell'
|
|
|
|
For instance:
|
|
|--$ flask shell
|
|
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
|
|
[GCC 8.2.0] on linux
|
|
App: spark [production]
|
|
Instance: /home/user/app/instance
|
|
>>> user = User.query.first()
|
|
>>> print(user)
|
|
<User johnwhite>
|
|
"""
|
|
return {"db": db, "User": User}
|