#NEWLINE# @ task #NEWLINE# def enter( context , install_dependencies = True , upgrade_db = True ) : #NEWLINE# #INDENT# '\n    Enter into IPython notebook shell with an initialized app.\n    ' #NEWLINE# if upgrade_db : #NEWLINE# #INDENT# context . invoke_execute ( context , 'app.dependencies.install' ) #NEWLINE# #UNINDENT# if upgrade_db : #NEWLINE# #INDENT# context . invoke_execute ( context , 'app.db.upgrade' ) #NEWLINE# context . invoke_execute ( context , 'app.db.init_development_data' , upgrade_db = False , skip_on_failure = True ) #NEWLINE# #UNINDENT# import pprint #NEWLINE# import logging #NEWLINE# from werkzeug import script #NEWLINE# import flask #NEWLINE# import app #NEWLINE# flask_app = app . create_app ( ) #NEWLINE# def shell_context( ) : #NEWLINE# #INDENT# context = dict ( pprint = pprint . pprint ) #NEWLINE# context . update ( vars ( flask ) ) #NEWLINE# context . update ( vars ( app ) ) #NEWLINE# return context #NEWLINE# #UNINDENT# with flask_app . app_context ( ) : #NEWLINE# #INDENT# script . make_shell ( shell_context , use_ipython = True ) ( )