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?

davidism
  • 121,510
  • 29
  • 395
  • 339
rablentain
  • 6,641
  • 13
  • 50
  • 91

1 Answers1

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))
Matt M
  • 193
  • 1
  • 7
davidism
  • 121,510
  • 29
  • 395
  • 339