Skip to content

Commit 76ca546

Browse files
authored
Clarify the importance of registering plotly app (#335)
1 parent 7553a78 commit 76ca546

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/installation.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Then, add ``django_plotly_dash`` to ``INSTALLED_APPS`` in the Django ``settings.
1515
...
1616
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
1717
...
18-
]
18+
]
1919

2020
The project directory name ``django_plotly_dash`` can also be used on its own if preferred, but this will stop the use of readable application names in
2121
the Django admin interface.
@@ -49,9 +49,15 @@ database::
4949

5050
./manage.py migrate
5151

52-
The ``plotly_app`` tag in the ``plotly_dash`` tag library can then be used to render any registered dash component. See :ref:`simple_use` for a simple example.
52+
It is important to ensure that any applications are registered using the ``DjangoDash`` class. This means that any python module containing the registration code has to be known to Django and loaded at the appropriate time.
53+
54+
.. note::
55+
An easy way to ensure the Plotly app is to import it into ``views.py`` or ``urls.py`` as in the following example,
56+
which assumes the ``plotly_app`` module (``plotly_app.py``) is located in the same folder as ``views.py``::
57+
58+
from . import plotly_app
5359

54-
It is important to ensure that any applications are registered using the ``DjangoDash`` class. This means that any python module containing the registration code has to be known to Django and loaded at the appropriate time. An easy way to ensure this is to import these modules into a standard Django file loaded at registration time.
60+
Once your Plotly app is registered, ``plotly_app`` tag in the ``plotly_dash`` tag library can then be used to render it as a dash component. See :ref:`simple_use` for a simple example.
5561

5662
Extra steps for live state
5763
--------------------------

0 commit comments

Comments
 (0)