2017-04-01 55 views
0

我刷新我的浏览器不更新中...运行后,但
改变也不会在浏览器的Python:js代码在烧瓶

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) 

什么,我做错了什么影响呢?

回答

0

根据你的代码,你需要有一个目录结构如下:

app 
|_ 
    run.py 
    templates/ 
    |_create_conf_view.html 

根据docs你不应该渲染模板时,通过templates

更改原始文件,看看它的工作原理:

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) 

而且一定要在指定的端口来访问你的应用程序!

+0

它正在工作......谢谢@dimmg – MaheshPVM