python dcc.Location opening new page within a page

Question:

I have several dash apps in a html files, example of html with app ‘viewer’:

{% extends 'base.html' %}
{% load static %}
{% block content %}
     {% load plotly_dash %}
<h1>Viewer</h1>

    <div class="{% plotly_class name='viewer' %} card" style="height: 100%; width: 100%">
    {% plotly_app name='viewer' ratio=0.7 %}
    </div>
<br>
    {{ plot1 | safe }}

{% endblock %}

I am trying to open another html from a dash app using dcc.Location (a callback provides a href back to this after a button is clicked) but it loads the html within the current html so I end up with two of all the side menu’s, search bars etc.. How do I get the app to load a whole new page? Even opening the link on a new tab would suffice.

Asked By: Gareth Simons

||

Answers:

So after doing some reading I have solved the problem but will answer here for anyone else that has a similar issue. It is a very simple solution, you just need to change plotly_app to plotly_direct in the html file above. You will then subsequently need to add (plotly_header} and {plotly_footer} above and below this repectively and remove ratio from the original plotly_app section.

https://django-plotly-dash.readthedocs.io/en/latest/template_tags.html

Answered By: Gareth Simons
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.