Flask- 404 页面未找到,flask web 开发

Flask- 404 page not found , flask web development

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

@app.route("/ ", methods=['GET', 'POST'])
def home():
    return "hello world"
port = int(os.environ.get('PORT', 5000))
if __name__== '__main__':
 app.run( port=port,debug=True)

错误:

 * Serving Flask app "pythonweb" (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: 250-679-261
  Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

127.0.0.1 - - [30/Jul/2020 01:00:05] "GET / HTTP/1.1" 404 -
127.0.0.1 - - [30/Jul/2020 01:00:07] "GET / HTTP/1.1" 404 -

从路线中删除 space:

@app.route("/", methods=['GET', 'POST'])