responder
responder copied to clipboard
How to deploy to server
Hi, How I can deploy it to server? I'm running Flash with Apache and Gunicorn. Is the setup step is same? Thanks.
@sieunhando You can't run https://github.com/benoitc/gunicorn only, you need https://github.com/encode/uvicorn because of asgi nature of responder
Deployment could be done like following https://github.com/the-benchmarker/web-frameworks/blob/master/python/responder/Dockerfile#L11
@sieunhando You can't run https://github.com/benoitc/gunicorn only, you need https://github.com/encode/uvicorn because of asgi nature of
responder
Deployment could be done like following https://github.com/the-benchmarker/web-frameworks/blob/master/python/responder/Dockerfile#L11
Thanks. It's working.
Just leaving a basic Heroku example here, hopefully it will show up if people search the repo for mentions of Heroku:
Project layout:
.
├── app.py
├── Pipfile
├── Pipfile.lock
├── Procfile
└── ...
app.py:
import responder
api = responder.API(enable_hsts=False)
...
Procfile:
web: uvicorn app:api --host 0.0.0.0 --port $PORT
With Flask and other frameworks, their builtin servers are not suitable for production, which is why you need gunicorn, for example.
In contrast, responder boasts a production-ready server out-of-the-box: uvicorn.
For configuring Apache, you may or may not have to change how you're doing this now, depending on how you've configured Apache to run your app.
If you're using a reverse-proxy setup, you're good to go. If you're using mod_wsgi
you'll need to do something else.
My recommendation would be to use Apache or NGINX or similar as a reverse proxy to responder running on an unprivileged port. Even though people do it, you probably don't want to expose your ASGI/WSGI server directly to the outside world; you'll want a proper webserver (e.g. Apache/NGINX in-between.