
This can be overriden in the command line by
use_reloader – Flag whether to use the auto-reloader. This can be overriden in the command line use_debugger – Flag whether to default to using the Werkzeug debugger. Server ( host='127.0.0.1', port=5000, use_debugger=None, use_reloader=None, threaded=False, processes=1, passthrough_errors=False, ssl_crt=None, ssl_key=None, **options ) ¶ The IPython shell can be turned off in commandĬlass flask_script. use_ipython – use IPython shell if available, ignore if not. The BPython shell can be turned off in command use_bpython – use BPython shell if available, ignore if not. The PtPython shell can be turned off in command use_ptpython – use PtPython shell if available, ignore if not. The PtIPython shell can be turned off in command use_ptipython – use PtIPython shell if available, ignore if not. Returns a dict consisting of just the app. make_context – a callable returning a dict of variables. banner – banner appearing at top of shell when started. Runs a Python shell inside Flask application context. Shell ( banner=None, make_context=None, use_ipython=True, use_bpython=True, use_ptipython=True, use_ptpython=True ) ¶ Should takeĪrguments as configured by the Command options. This must be implemented by the subclass. Need to do instance-specific configuration. Parameters:įunc – Initialize this command by introspecting the function.īy default, returns self.option_list.
Command ( func=None ) ¶īase class for creating commands. The decorated function should take a single “app” argument, and returnįor more sophisticated usage use the Shell class. add_command ( "shell", Shell ( make_context = _make_context )) Then the user can register the sub-manager to their primary Manager (within manage.py):ĭef _make_context ( app ): return dict ( app = app ) manager. setup () if sample_data : from fixtures.sample_data import all sample_data = dbfixture. command def populate ( default_data = False, sample_data = False ): "Populate database with default data" from fixtures import dbfixture if default_data : from fault_data import all default_data = dbfixture. command def recreate ( default_data = True, sample_data = False ): "Recreates database tables (same as issuing 'drop' and then 'create')" drop () create ( default_data, sample_data ). create_all () populate ( default_data, sample_data ). command def create ( default_data = True, sample_data = False ): "Creates database tables from sqlalchemy models" db. command def drop (): "Drops database tables" if prompt_bool ( "Are you sure you want to lose all your data" ): db. Manager = Manager ( usage = "Perform database operations" ).