Ask coding questions

← Back to all posts
gunicorn on Replit?
BaconErie (6)

Hello,

I'm trying to deploy Flask on Replit, and would like to use gunicorn instead of the built-in Flask webserver. Does anyone know how to use gunicorn with Flask on Replit?

Thanks,
BaconErie

Comments
hotnewtop
BaconErie (6)

Found a somewhat working solution:

This assumes you already have a Flask app and flask installed

  1. Install gunicorn using the "Packages" in Replit or do pip install gunicorn in the shell

  2. Run gunicorn --bind 0.0.0.0:5000 main:app in the shell. Replace main with the name of the Python file with your flask app.

This should load your website. However, I don't know how to install nginx as a reverse proxy for gunicorn on Replit, and having a reverse proxy is recommended with gunicorn, so it may be best to use another hosting app.

Edit: I did realize that Replit is sort of a proxy web server, so you might be able to get away with hosting on Replit.