只得到一个没有错误的白色空白屏幕。我已经在Pycharm中进行了尝试,那里没有问题,只有在VS Code中
Flask app.py:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
app.run(
port=5000,
debug=True
)
HTML:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
Hello World!
</body>
</html>
我正在尝试使用以下地址访问我的页面:http://127.0.0.1:5000/
这是浏览器中的外观: [1]:https://i.stack.imgur.com/to4X9.png
答案 0 :(得分:0)
您是否尝试过添加?还是您正在使用其他文件来运行您的应用程序?
if __name__ == '__main__':
app.run(
port=5000,
debug=True)