Skip to content

Key Error [Question] #102

@vantaka2

Description

@vantaka2

Just starting out and can't seem to insert dash into one of my django Applications. I followed the installation and simple usage guide.

I have done the following:

added 'django_plotly_dash.apps.DjangoPlotlyDashConfig' to INSTALLED_APPS in settings.
added 'django_plotly_dash.middleware.BaseMiddleware', to MIDDLEWARE in settings

added path('django_plotly_dash/', include('django_plotly_dash.urls')), to my projects urls.py file

Successfully updated the database

created dash app nammed 'dash_app.py' and its located in the same folder as the projects settings.py and urls.py file.

Updated template to include
{%load plotly_dash%} {%plotly_app name="SimpleExample"%}

and lastly my view.py file looks like this:
`class HomePage2(ListView):
model = main_kpi
template_name = 'home\home.html'
context_object_name = 'list_of_kpis'

def get_context_data(self, **kwargs):
    # Call the base implementation first to get a context
    context = super().get_context_data(**kwargs)
    dash_context = self.request.session.get("django_plotly_dash", dict())
    dash_context['django_to_dash_context'] = "I am Dash receiving context from Django"
    self.request.session['django_plotly_dash'] = dash_context
    return context

`

When I bring up the application in debug mode I get the following error:
KeyError at /home/ 'Unable to find stateless DjangoApp called simpleexample'

Is there something i'm missing? Happy to update docs with a straight forward how to guide for beginners if I can get this figured out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions