首页 > 解决方案 > 如何使用 KapellaTemplate 正确集成运行 Flask (app.py)

问题描述

我想知道如何使用flask app.py 来利用来自Kapella-Free-Bootstrap-Admin-Template 的免费模板。感谢您对此事的帮助。谢谢你。

app = flask.Flask(__name__)


@app.route("/")
def index():
    return flask.render_template("index.html")

if __name__ == "__main__":
    import os

    port = 8000

    # Open a web browser pointing at the app.
    os.system("open http://localhost:{0}".format(port))

    # Set up the development server on port 8000.
    app.debug = True
    app.run(host='0.0.0.0', port=port)

结构如下

app.py
templates
 index.html
 css
 images

当我运行 app.py 时......页面出来但没有图像......不是很好的格式 在此处输入图像描述

模板应如下所示 在此处输入图像描述

感谢帮助。谢谢

标签: pythontemplatesflaskdashboard

解决方案


推荐阅读