Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python flask的runserver出错_Python_Python 3.x_Flask - Fatal编程技术网

Python flask的runserver出错

Python flask的runserver出错,python,python-3.x,flask,Python,Python 3.x,Flask,源代码在书中,代码中没有错误。为什么会发生错误 from flask import Flask, render_template from flask_script import Manager app = Flask(__name__) manager = Manager(app) @app.route('/') def index(): return render_template('index.html') @app.route('/user/<name&

源代码在书中,代码中没有错误。为什么会发生错误

    from flask import Flask, render_template
from flask_script import Manager

app = Flask(__name__)

manager = Manager(app)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/user/<name>')
def user(name):
    return render_template('user.html', name=name)


if __name__ == '__main__':
    manager.run()
从烧瓶导入烧瓶,渲染\u模板
从脚本导入管理器
app=烧瓶(名称)
经理=经理(应用程序)
@应用程序路径(“/”)
def index():
返回渲染模板('index.html')
@app.route(“/user/”)
def用户(名称):
返回呈现模板('user.html',name=name)
如果uuuu name uuuuuu='\uuuuuuu main\uuuuuuu':
manager.run()
在user.html中

<h1>Hello, {{ name }}!</h1>
你好,{{name}!

注意“地址已在使用”错误:您试图在已在使用的端口上设置服务器。杀死以前的服务器(正在使用该端口)或在其他端口上运行此服务器