在Django中托管Dash交互式应用- InvalidConfig ' routes_pathname_prefix



我已经建立了一个Dash应用程序,它有回调函数和我需要的一切。现在我想在Django应用程序中托管它。我已经尝试了三天,但一直得到:

routes_pathname_prefix需要从/开始

调试时,我注意到我的url_base_pathname以'https'开头,但我是新来的,所以我很困惑。

我的应用app = DjangoDash(name='SimpleExample', )

设置
PLOTLY_COMPONENTS = [
'dash_core_components',
'dash_html_components',
'dash_table',
'dash_renderer',
'dpd_components',
]
X_FRAME_OPTIONS = 'SAMEORIGIN'
ASGI_APPLICATION = "core.routing.application"
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379), ],
},
},
}
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django_plotly_dash.finders.DashAssetFinder',
'django_plotly_dash.finders.DashComponentFinder',
)
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"home",
"generate_train_data",
"preprocess_train_data",
"django_plotly_dash.apps.DjangoPlotlyDashConfig",
"channels",
"channels_redis",
]

我的HTML扩展

{% extends 'home.html' %}
{% block content %}
{% load plotly_dash %}
<body>
<div class="{% plotly_class name="SimpleExample" %} card" style="height: 100%; width: 100%;">
{% plotly_app name="SimpleExample"%}
</div>
</body>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
{{script| safe}}
{% endblock content %}

的url
urlpatterns= [
path("", include('preprocess_train_data.urls')),
path("", include('prediction.urls')),
path("django_plotly_dash/", include('django_plotly_dash.urls')),] + static(settings.STATIC_SUFFIX, document_root=settings.STATIC_ROOT)

似乎无论我怎么做都没有用,任何帮助都是非常感谢的。

你看到了吗?它可能是一些已经修复的错误。请尝试更新您的软件到更高版本。

最新更新