doc: mention how to configure Daphne (channels interface server)

Closes https://github.com/jazzband/django-configurations/pull/164.
This commit is contained in:
e_fpischedda 2016-11-08 09:29:19 +01:00 committed by Daniel Hahler
parent 4fea22bd16
commit 6ed4559c92

View file

@ -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 <http://github.com/django/daphne/>` as the
`interface server <http://channels.readthedocs.io/en/latest/deploying.html#run-interface-servers>`
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.