21

I am planing to deploy my Django application with HTTP/2 protocol but I'm unable to find the proper solution. How can I serve my Django web application with HTTP/2, the only thing that I find is hyper-h2.

I read the documentation but unable to setup the connections.

3 Answers 3

15

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

Sign up to request clarification or add additional context in comments.

3 Comments

Knowing that gunicorn doesn't support http2, this can be enough ?
Should be enough as Nginx is going to terminate the connection here and will connect with gunicorn via another internal set protocol/channel.
Setting http2 in listen is deprecated in nginx 1.25+. Use http2 on; on the next config line instead.
5

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.

1 Comment

Agreed and there is little need to speak it all the way through: stackoverflow.com/questions/41637076/…
4

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.