这是代码:from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__' :
app.run(debug=True)
就是在@app.route('/')的‘/’后加什么,就会404报错,或者在return 'Hello World!'后加内容,在网页中也不显示内容。
cmd的内容:
C:\Users\Administrator\Desktop>python test_flask.py
* Serving Flask app "test_flask" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 118-883-086
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Detected change in 'C:\\Users\\Administrator\\Desktop\\test_flask.py', reload
ing
* Restarting with stat
* Debugger is active!
* Debugger PIN: 118-883-086
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
不能像课程里面老师在网页上改地址后能够显示内容。
一次实战同时掌握Python操作MySQL,MongoDB,Redis 三大数据库使用技巧
了解课程
1.6k 13
1.4k 12
3.6k 12
2.0k 11
6.2k 10