Run python flask on EC2 in the background
Asked Answered
M

1

8

I have small app created on python flask and deployed on EC2 aws machine, when I do ssh to ec2 machine and starts flask, it works, but when I terminate the session the flask dies, I can run it using nohup. What is the best way to make it independent of ssh session and run it continuously.

Means answered 12/4, 2014 at 10:55 Comment(1)
Thanks alot for this question tooColdhearted
F
20

There are several options:

  1. nohup python app.py &
  2. use screen
  3. run supervisord(link) on system startup and control all through it (pythonic way :))

nohup means: do not terminate this process even when the stty is cut off.

& at the end means: run this command as a background task.

Fiat answered 12/4, 2014 at 13:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.