首先我们要导入文件
第一步:
from livereload import Server
第二步:
在app运行的时候监听`
if __name__ == '__main__':
live_server = Server(app.wsgi_app)
live_server.watch('**/*.*')
live_server.serve(open_url_delay=1)
manager.run()
所以我们__init__.py
里面的代码看起来应该是这样:
from flask import Flask
from flask_script import Manager
from livereload import Server
app = Flask(__name__)
app.config['DEBUG'] = True
manager = Manager(app)
@app.route('/')
def index():
return "Hello word!!!____LFC"
if __name__ == '__main__':
live_server = Server(app.wsgi_app)
live_server.watch('**/*.*')
live_server.serve(open_url_delay=1)
manager.run()
网友评论