【问题标题】:Flask not working, shows error in port 5000烧瓶不工作,端口 5000 显示错误
【发布时间】:2021-08-31 12:58:28
【问题描述】:

代码没有显示任何错误,但在输出端口,即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)

【问题讨论】:

  • 不要发布图片,而是使用 ctrl+k 代码过滤器发布代码。这也不是真正的错误使用调试模式app.run(debug=True)
  • 调试模式开启,你能告诉我代码有什么问题吗?
  • 我在代码中没有看到任何错误,可能发生了其他事情,你能把来自github的代码给我吗。

标签: python python-3.x flask web-applications


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-18
    • 2017-07-24
    • 2016-04-19
    相关资源
    最近更新 更多