python - 烧瓶不工作,在端口 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)
解决方案
看起来很奇怪,当我将整个项目文件夹从桌面移动到另一个目录时,该项目开始工作!我在这个目录中有我所有的 python 项目可能与 python 路径有关。
推荐阅读
- html - IE11 不使用文本溢出限制宽度:省略号
- c++ - 'HMAC_CTX' 的类型不完整
- vertica - vertica 数据库自动启动未运行
- python-3.x - Python 初学者 - 带有条件的密码生成器不会破坏 while 循环
- qt - QMediaPlayer 流播放在 Windows 中不起作用
- php - 如何访问数组 Php/Laravel 中的属性
- javascript - 如何使用 JavaScript 更改每个列表项的背景颜色?
- python - Python Selenium 将网页上的所有 url 扩展作为列表获取
- java - Gradle 运行任务在尝试使用 System.in 时抛出 java.util.NoSuchElementException
- python - 如何根据顺序过滤掉某些数字以添加到列表中?