Key Error [Question]
See original GitHub issueJust 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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)

Top Related StackOverflow Question
After a lot trial and error I think I found what I did wrong. in url.py I never imported my dash file:
from . import dash_appThis is even stated in the ‘Simple Useage’
The example Django application in the demo subdirectory achieves this through an import in the main urls.py fileMight be a bit easier for beginners to show the actual import? I can submit a pull request if you think that would be worthwhile.
Thanks!
I opened another pull request to clarify how to register the Plotly app with Dash in the Installation document.