skip to Main Content

I have my flask app running on ec2 instance with nginx and gunicorn3. The problem that I have is the following.
When I SSH into the EC2 machine and start the Gunicorn server gunicorn3 app:app, all routes work fine and I can use then. But, after I close my terminal window, only few routes work and others don’t. (Out of 20 routes, only 3-4 work). I am using MongoDB database but that is not the problem because some routes that have MongoDB code work perfectly fine, while others that also have MongoDB code don’t.

Any help would be awesome.

Thank You

2

Answers


  1. Chosen as BEST ANSWER

    The answer is to add -daemeon when running gunicorn3 app:app. So the full command is gunicorn3 app:app --daemeon.


  2. The best way to check the problem is to inspect logs, make sure you have enabled logs in nginx and gunicorn and you will be able to backtrack what is happening behind the scenes. Also make sure to run gunicorn via supervisor, in any case if the process gets killed it will be auto-restarted.

    Reference :

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search