简体   繁体   中英

Deploying Sanic Raw

Sanic appears to be a highly perfomant web framework (server) for Python. From experience with other frameworks, including Flask and Django I know that it is generally recommended to put the Python server behind another server (eg reverse Proxy) like Nginx for security reasons. How does that translate to Sanic, or a gunicorn server running Sanic? Does someone have experience with that. I wonder if it is safe to expose a Python server to the web.

I haven't deployed sanic to a prod environment yet, but previous deploys followed the following logic:

Internet <-> Nginx <-> Uwsgi (or gunicorn) <-> python framework (django or other framework)

According to this Deploy Sanic you can launch sanic with multiple workers and behind gunicorn.

So I am guessing nginx <-> gunicorn <-> gunicorn myapp:app --bind 0.0.0.0:8080 --worker-class sanic.worker.GunicornWorker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM