from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World'
if __name__ == '__main__':
app.run()
__name__
找其他文件
Flask( )
括号中参数需要填其他内容
app.route()
* 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: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def hello_world():
return 'Hello World'
if __name__ == '__main__':
app.run()