From 6ed4559c925d53b5165f47a964bf5807ee9f5c27 Mon Sep 17 00:00:00 2001 From: e_fpischedda Date: Tue, 8 Nov 2016 09:29:19 +0100 Subject: [PATCH] doc: mention how to configure Daphne (channels interface server) Closes https://github.com/jazzband/django-configurations/pull/164. --- docs/cookbook.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/cookbook.rst b/docs/cookbook.rst index cf7c66f..93b781b 100644 --- a/docs/cookbook.rst +++ b/docs/cookbook.rst @@ -252,3 +252,27 @@ the environment variable accordingly: Please note that the sphinx callable has been moved from ``configurations`` to ``configurations.sphinx``. + + +Channels +-------- + +If you want to deploy a project that uses the Django channels with +`Daphne ` as the +`interface server ` +you have to use a asgi.py script similar to the following: + +.. code-block:: python + + import os + from configurations import importer + from channels.asgi import get_channel_layer + + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "your_project.settings") + os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev') + + importer.install() + + channel_layer = get_channel_layer() + +That will properly load your django-configurations powered settings.