[英]Dash bootstrap components not showing
I wanted to have progress bar in my Django project but it is not showing on page.我想在我的 Django 项目中有进度条,但它没有显示在页面上。 I have installed django-dash and dash-bootstrap-components.
我已经安装了 django-dash 和 dash-bootstrap-components。 Code:
代码:
import dash_html_components as html
import dash_bootstrap_components as dbc
from django_plotly_dash import DjangoDash
app = DjangoDash("Progress", add_bootstrap_links=True)
app.layout = html.Div(dbc.Progress(value=100))
and template和模板
{% load plotly_dash %}
<div class="{% plotly_class name="Progress" %}">
{% plotly_app_bootstrap name="Progress" %}
</div>
I had a hard time figuring out why dash-bootstrap-components are not loaded on my Django dash app.我很难弄清楚为什么我的 Django dash 应用程序上没有加载 dash-bootstrap-components。 I figured out the problem using simple steps available at:
我使用以下简单步骤解决了问题:
https://django-plotly-dash.readthedocs.io/en/latest/bootstrap.html#using-bootstrap https://django-plotly-dash.readthedocs.io/en/latest/bootstrap.html#using-bootstrap
This can be tricky to set up - you have to follow all of the installation steps.这可能很难设置 - 您必须遵循所有安装步骤。 There is a summary in the project documentation:
项目文档中有一个总结:
STATICFILES_FINDERS
, PLOTLY_COMPONENTS
and MIDDLEWARE
ones.STATICFILES_FINDERS
、 PLOTLY_COMPONENTS
和MIDDLEWARE
。pip install django-bootstrap4
and add bootstrap4
to INSTALLED_APPS
in the project's settings.py
filepip install django-bootstrap4
并将bootstrap4
添加到项目的settings.py
文件中的INSTALLED_APPS
STATIC_ROOT
, as described in the Django documentationSTATIC_ROOT
,如 Django 文档中所述prepare_demo
script or perform the equivalent steps, particularly the migrate
and collectstatic
stepsprepare_demo
脚本或执行等效步骤,尤其是migrate
和collectstatic
步骤
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.