03.Python Dash网页开发:多页面网站制作

本文介绍了如何使用Python Dash创建一个多页面的网站,包括首页、博客链接、关于页面。首页包含旋转木马展示和DASH APP,APP部分包括一个链接到Shiny的外部网站和其他DASH示例。虽然网站功能基本实现,但美化工作仍有待完善。文章提供了源代码目录结构和页面注册方法。
摘要由CSDN通过智能技术生成

<~生~信~交~流~与~合~作~请~关~注~公~众~号@生信探索>

需求:写一个多网页的网站,包括header、footer、菜单包括主页home、博客blog(外部链接到博客)、about(自我介绍页面)

home页面包括一个旋转木马(几张图片循环播放)、再下边单个APP点击后进入可以分析)。

其中第一个APP是shiny APP,用外部网址链接到shiny网站,其他APP是DASH 示例APP。

网站大概满足了功能需求,但是美化细节还没做到...

alt

源代码文件夹

├── app.py
├── pages
│   ├── about.py
│   ├── home.py
│   ├── iris.py
│   └── not_found_404.py
└── static
    ├── about.md
    └── images
        ├── profile.jpg
        └── slide0.jpg

主要APP入口

import dash
from dash import Dash, dcc, html, Input, Output, callback
import plotly.express as px
import dash_bootstrap_components as dbc

dbc_css = "https://cdn.jsdelivr.net/gh/AnnMarieW/dash-bootstrap-templates@V1.0.4/dbc.min.css"
app = Dash(__name__, external_stylesheets=[dbc.themes.MINTY, dbc_css], use_pages=True)

navbar = dbc.NavbarSimple(
    [
        dbc.NavItem(dbc.NavLink("Home", href="/")),
        dbc.NavItem(dbc.NavLink("Blog", href="https://www.baidu.com")),
        dbc.NavItem(dbc.NavLink("About", href="/about")),
    ],
    brand="Bioinformatics Quest",
    brand_href="#",
    color="primary",
    dark=True,
)

app.layout = dbc.Container(
    [
        dbc.Row(dbc.Col(navbar,width=8),class_name="d-flex justify-content-center mt-2 mb-2"),
        dbc.Row(
            dbc.Col(
                    dash.page_container,
                    width=8,
                    # style={"height": "85vh"}
                    )
                    ,class_name="mh-100 d-flex justify-content-center"
                ),
        dbc.Row(
            html.Footer("2023 Bioinformatics Quest All Right Reserved.",className="d-flex justify-content-center")
            ,class_name="d-flex justify-content-center"
            )
    ], 
    fluid=True,
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值