Run app from Flask-Migrate manager
Asked Answered
J

1

6

I used these lines to start my application:

from app import app
app.run(host='0.0.0.0', port=8080, debug=True)

Using Flask-Migrate, I have this instead:

from app import manager
manager.run()

manager.run does not take the same arguments as app.run, how do I define host and port?

Jadeite answered 16/1, 2016 at 8:24 Comment(0)
L
18

manage.py replaces running the app with python app.py. It is provided by Flask-Script, not Flask-Migrate which just adds commands to it. Use the runserver command it supplies to run the dev server. You can pass the host and port to that command:

python manage.py runserver -h localhost -p 8080 -d

or you can override the defaults when configuring the manager:

from flask_script import Manager, Server
manager = Manager()
manager.add_command('runserver', Server(host='localhost', port=8080, debug=True))
Lucid answered 16/1, 2016 at 19:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.