更改 DASH 中的图标和 HTML 标题

问题描述 投票:0回答:1

是否可以更改 Dash Python 应用程序生成的 HTML 页面的图标和标题?

我使用了以下代码,但它不起作用

import dash
from dash import html

app = dash.Dash(__name__)


app.layout = html.Meta([
    html.Link(
        rel='icon',
        href='assets/icon.ico',
        type='imagex/ico'
    ),
    html.Title(
        title='My App'
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)
python plotly-dash plotly-python
1个回答
0
投票

是的,你可以这样做

app = Dash(__name__)
app.title = "My title"
app._favicon = ("my_icon.png")

图标图像文件必须位于assets文件夹中

© www.soinside.com 2019 - 2024. All rights reserved.