首页 > 解决方案 > 烧瓶不工作,在端口 5000 中显示错误

问题描述

该代码没有显示任何错误,但在输出端口上,即http://127.0.0.1:5000/显示内部服务器错误。

这是我的代码

from flask import Flask,render_template
app = Flask(__name__)


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


@app.route('/about')
def virtualization():
    return render_template('about.html')


@app.route('/services')
def service():
    return render_template('services.html')


if __name__ == '__main__':
    app.run(debug=True)

并在输出端

 * Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 264-698-791
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

这是错误

标签: pythonpython-3.xflaskweb-applications

解决方案


看起来很奇怪,当我将整个项目文件夹从桌面移动到另一个目录时,该项目开始工作!我在这个目录中有我所有的 python 项目可能与 python 路径有关。


推荐阅读