运行flask web app时出现内部服务器错误500

2024-03-28 09:48:45 发布

您现在位置:Python中文网/ 问答频道 /正文

内部服务器错误

服务器遇到内部错误,无法完成您的请求。服务器过载或应用程序中存在错误

烧瓶应用程序代码为:

from flask import Flask, render_template
import numpy as np
app = Flask(__name__)
@app.route('/')
def home():
    return render_template("index1.html")
if __name__ == "__main__":
   app.run(debug = True)

index1.html是:

<html>
<body>
<h1>This is index page...</h1>
</body>
</html>

Tags: nameimport服务器app应用程序flask烧瓶html
1条回答
网友
1楼 · 发布于 2024-03-28 09:48:45

烧瓶需要一定的结构。所有模板(html文件)都需要位于目录templates中。所以,我假设你目前的结构是这样的

project/
|- app.py
|- index1.html

对吗?换成这个

project/
|- templates/
|  |- index1.html
|- app.py

相关问题 更多 >