responder icon indicating copy to clipboard operation
responder copied to clipboard

How to deploy to server

Open theblackturtle opened this issue 5 years ago • 4 comments

Hi, How I can deploy it to server? I'm running Flash with Apache and Gunicorn. Is the setup step is same? Thanks.

theblackturtle avatar Nov 06 '18 05:11 theblackturtle

@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

waghanza avatar Nov 06 '18 11:11 waghanza

@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.

theblackturtle avatar Nov 07 '18 03:11 theblackturtle

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

mathiasose avatar Nov 26 '18 10:11 mathiasose

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.

spyoungtech avatar Nov 28 '18 21:11 spyoungtech