Creating our first page with Daphne
Let’s begin by activating all the real-time capabilities that Channels has to offer. So, we are going to enable Channels in the configuration, change the WSGI server for ASGI, and build a minimal HTML page to check that everything is running correctly. We will continue the application we started in Chapter 2, Creating a Django Project around Docker. If you don’t have the code, you can use the example available in the following repository: https://github.com/PacktPublishing/Building-SPAs-with-Django-and-HTML-Over-the-Wire/tree/main/chapter-2.
Let’s begin:
- The first thing we are going to do is to activate Channels. To do this, we open
hello_world/settings.py
, and underINSTALLED_APPS
, we addapp.simple_app
(put it at the end) andchannels
(put it first):INSTALLED_APPS = [ ' channels', # New line 'django.contrib.admin', 'django...