Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ More detailed information
can be found in the online documentation at
<https://readthedocs.org/projects/django-plotly-dash>

An online version of the demo can be found at <https://djangoplotlydash.com>


## Installation

Expand Down Expand Up @@ -49,7 +51,7 @@ For the final installation step, a migration is needed to update the
database::

./manage.py migrate

Note that this package requires version 2.0 or greater of Django, due to the use of the `path` function for registering routes.

Further configuration, including live updating to share application
Expand Down
2 changes: 1 addition & 1 deletion django_plotly_dash/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def static_asset_path(module_name, asset_path):
return static_path(full_asset_path(module_name, asset_path))

def serve_locally():
return _get_settings().get('serve_locally', settings.DEBUG)
return _get_settings().get('serve_locally', False)

def static_path(relative_path):
try:
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ below.
"cache_arguments": True,

# Flag controlling local serving of assets
"serve_locally': settings.DEBUG,
"serve_locally': False,
}

Defaults are inserted for missing values. It is also permissible to not have any ``PLOTLY_DASH`` entry in
Expand Down
4 changes: 4 additions & 0 deletions docs/demo_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ the `github repository <https://github.com/GibbsConsulting/django-plotly-dash/tr
There is a more details walkthrough of the :ref:`session state storage <session_example>` example. This example also
shows the use of `dash bootstrap components <https://pypi.org/project/dash-bootstrap-components/>`_.

The demo application can also be viewed `online <https://djangoplotlydash.com>`_.


.. _session_example:

Session state example walkthrough
---------------------------------

Expand Down
23 changes: 2 additions & 21 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,9 @@ the :ref:`configuration <configuration>` of the host and port for channels is se
the Django project.

During development, it can be convenient to serve the ``Dash`` components
locally. Passing ``serve_locally=True`` to a ``DjangoDash`` constructor will cause all of the
locally. Whilst passing ``serve_locally=True`` to a ``DjangoDash`` constructor will cause all of the
css and javascript files for the components in that application from the
local server. Additional Django settings are also needed to serve the
static files::

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATICFILES_DIRS = [] # Or other sources as needed

if DEBUG:

import importlib

for dash_module_name in ['dash_core_components',
'dash_html_components',
'dash_renderer',
'dpd_components',
]:

module = importlib.import_module(dash_module_name)
STATICFILES_DIRS.append(("dash/%s"%dash_module_name, os.path.dirname(module.__file__)))
local server, it is recommended to use the global ``serve_locally`` configuration setting.

Note that it is not good practice to serve static content in production through Django.

Expand Down
6 changes: 5 additions & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ No, it is needed. Consider this example (it is part of ``demo-nine``):
The first ``Img`` will have its source file correctly served up by Django as a standard static file. However, the second image will
not be rendered as the path will be incorrect.

See the :ref:`local_assets` section for more information on `configuration` with local assets.
See the :ref:`local_assets` section for more information on configuration with local assets.

* Is there a live demo available?

Yes. It can be found `here <https://djangoplotlydash.com>`_
3 changes: 3 additions & 0 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ these features:
There is nothing here that cannot be achieved through expanding the Flask app around Plotly Dash, or indeed by using an alternative web
framework. The purpose of this project is to enable the above features, given that the choice to use Django has already been made.

The source code can be found in `this github repository <https://https://github.com/GibbsConsulting/django-plotly-dash>`_. This repository also includes
a self-contained demo application, which can also be viewed `online <https://djangoplotlydash.com>`_.

.. _overview:

Overview
Expand Down