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.