How to server HTTP/2 Protocol with django

 ̄綄美尐妖づ 提交于 2020-12-29 06:07:24

问题


I am planing to deploy my django project with HTTP/2 protocol but I unable to find the proper way how can I server my django based website with HTTP/2, the only thing that I find is hyper-h2.

I read the documentation but unable to setup the connections. If anybody know how to server django on HTTP/2.


回答1:


You can do with Nginx proxy

if you have existing nginx config. you do by just adding a word .http2 in listen

    listen 443 ssl http2 default_server;

full document avaliable in

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-16-04




回答2:


One option is to use Apache httpd server with mod_wsgi. Apache supports terminating HTTP/2. The link to your Django application is still via WSGI API so you don't really get any access to HTTP/2 specific features in your application. You can though configure Apache to do things like server push on your behalf.

  • https://httpd.apache.org/docs/2.4/howto/http2.html
  • https://httpd.apache.org/docs/2.4/mod/mod_http2.html



回答3:


To support HTTP 2.0, You can deploy Django apps on web servers like Daphne using ASGI (which is the spiritual successor to WSGI).

you can read more about deploying Django with ASGI in the official documentaion

to read more about ASGI and what is it, introduction to ASGI
to read more about Daphne server, official repository



来源:https://stackoverflow.com/questions/51225433/how-to-server-http-2-protocol-with-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!