[英]Dash bootstrap components not showing
我想在我的 Django 項目中有進度條,但它沒有顯示在頁面上。 我已經安裝了 django-dash 和 dash-bootstrap-components。 代碼:
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))
和模板
{% load plotly_dash %}
<div class="{% plotly_class name="Progress" %}">
{% plotly_app_bootstrap name="Progress" %}
</div>
我很難弄清楚為什么我的 Django dash 應用程序上沒有加載 dash-bootstrap-components。 我使用以下簡單步驟解決了問題:
https://django-plotly-dash.readthedocs.io/en/latest/bootstrap.html#using-bootstrap
這可能很難設置 - 您必須遵循所有安裝步驟。 項目文檔中有一個總結:
STATICFILES_FINDERS
、 PLOTLY_COMPONENTS
和MIDDLEWARE
。pip install django-bootstrap4
並將bootstrap4
添加到項目的settings.py
文件中的INSTALLED_APPS
STATIC_ROOT
,如 Django 文檔中所述prepare_demo
腳本或執行等效步驟,尤其是migrate
和collectstatic
步驟
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.