Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.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:js代码未在flask中更新_Python_Flask - Fatal编程技术网

Python:js代码未在flask中更新

Python:js代码未在flask中更新,python,flask,Python,Flask,我正在刷新浏览器…在运行之后, 浏览器中的更改不受影响 from flask import Flask, send_file, render_template, send_file app = Flask(__name__) @app.route('/') def hello_world(): return send_file('templates/create_conf_view.html') if __name__ == '__main__': app.run(debu

我正在刷新浏览器…在运行之后,
浏览器中的更改不受影响

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

@app.route('/')
def hello_world():
    return send_file('templates/create_conf_view.html')


if __name__ == '__main__':
    app.run(debug=True, use_reloader=True, host='0.0.0.0', port=1672,threaded=True)

我做错了什么?

根据您的代码,您需要具有如下目录结构:

app
|_
  run.py
  templates/
     |_create_conf_view.html
根据,渲染模板时不应传递
模板

将原始文件更改为,然后查看其是否有效:

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

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


if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=1672, thread=True)
还要确保在指定端口访问应用程序