How to configure Apache to run ASGI in Django Channels? Is Apache even required?

后端 未结 2 1696
你的背包
你的背包 2020-12-23 23:37

I built a django-project and deployed it to production using Apache-WSGI combo. For that I had added the apache2.conf as shown below:

WSGIS         


        
2条回答
  •  盖世英雄少女心
    2020-12-24 00:04

    Currently Apache does not have an ASGI server implementation. That means that you can continue to use Apache, but you will also need Daphne. In essence, Apache will change from being your primary web server to being a reverse proxy.

    There is potentially some value in doing that: Python developers have been running nginx in reverse proxy mode for years. However, Daphne is a very capable web server, being built on top of Twisted's web server, and so Apache certainly isn't necessary.

    For that moment, then, I recommend running just with Daphne: have Daphne listen on your primary ports and disable Apache altogether. If you find there are features of Apache you still want, you'll need to configure Apache as a reverse proxy: one suggested article for configuring that is this one from Digital Ocean.

提交回复
热议问题