How to use a production WSGI Flask server on autoscale Deployments?

Question: What is the correct way to set up a production WSGI server on Replit for flask autoscale deployments?

I found https://replit.com/talk/learn/How-to-set-up-production-environment-for-your-Flask-project-on-Replit/139169 from the pre-deployments era (Google excludes it when filtering from the past year) so I wonder whether or not it is still good advice. I’m terrified of accidentally leaving autoscale processes in an endless loop of compute unit use. Thank you.

Hi @jsalsman !
I would conncet it normally, I don’t think there’s anything different. Just setup the ports correctly and it should be fine.
Do test it first, though, and see if it’s burning your compute units.

5 Likes

Don’t worry, this is not possible. Autoscale deployments are only billed when HTTP requests are currently being processed, and all requests have a 5 minute timeout. It goes to sleep the rest of the time.

4 Likes

Sorry to re-open but @jsalsman did you get this working? My WSGI server runs completely fine through regularly running, but as soon as its in a Deployment I constantly get

command finished with error [sh -c python3 main.py]: signal: terminated

and the deployment restarts every 1-5 minutes. Application gets terminated, starts up again, ports get forwarded again, etc. It is burning through compute units without any requests. Again, does not do this during regular runs of code. This is happening on two deployments. Support nor Forum has responded in weeks so im at a loss here.

1 Like

No I’m using Flask with Socket.IO so I’m not sure how to configure this correctly, but it’s absolutely still on my TODO list.

1 Like