I am creating a jar application with a factory application, but have a problem when using Flask-Migrate with socketio and jar script.
The problem is that I pass the function create_appto Manager, but I need to pass appto my socketio.run(). And now I do not see a solution. Is there a way to combine these two solutions?
manage.py:
manager = flask_script.Manager(create_app)
manager.add_option("-t", "--testing", dest="testing", required=False)
manager.add_command("run", socketio.run(
app,
host='127.0.0.1',
port=5000,
use_reloader=False)
)
manager.add_command("db", flask_migrate.MigrateCommand)
When I used the old approach with socketio, but without flask-migrate everything worked. If I use a new approach and remove part of the socket, the migration will work.
Note. I would like to be able to invoke my application using both of the following commands.
python manage.py run
python manage.py -t True db upgrade
Edit:
Trying to use current_app, I getRuntimeError: working outside of application context
manager.add_command("run", socketio.run(
flask.current_app,
host='127.0.0.1',
port=5000,
use_reloader=False)
)
source
share