簡體   English   中英

Dash 引導組件未顯示

[英]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_FINDERSPLOTLY_COMPONENTSMIDDLEWARE
  • 使用pip install django-bootstrap4並將bootstrap4添加到項目的settings.py文件中的INSTALLED_APPS
  • 確保正確設置為 static 文件提供服務的設置,尤其是STATIC_ROOT ,如 Django 文檔中所述
  • 使用prepare_demo腳本或執行等效步驟,尤其是migratecollectstatic步驟

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM