First I will come with some feedback for your setup.
When you are building Python application its not recommended to use gunicorn as server host, its build for developing, you shut use uWSGI for your Python application.
Next when you are using proxy in NGINX I will recommend you to disable buffering for your proxy
proxy_buffering off;
When you are disable buffering you do the site a little bit slower in load time for the client becures its need to sending the full package from the server to the client. my expirers tell me its not so much when we are speaking web developing and its protect you in the long term if you want to run your application on multi server behind a load balancer like NGINX Proxy, Docker Cluster or something like that.
After my feedback, its sound like you have a something in your code there just go into a loop and never stop or you have a lonnnnnnnng SQL connection/query there take more then 3min to execute.
What I will recommend here its enable slow-log on your database so you can get a log for all querys there take more then 0.5sec its can be a missing index in your database there out perfomes the site.
Normal Python did not take 3min to execute a script/code area so its sound like a external services eg. database, api or something in this case.
When you have enabled slow log for your database, a secound case will be create a simple log for your script with "start time" + "end time" and dump it with the method/page/url there are hitting this area and dump it to a file so you easy can open it, late it run in the 5-6 hours as you speak about or longer to catch your error.
I think its the best way, first problem will be to find why you code take 3min to execute.