I us memcached from python to stock two datas (state) I use flask to create a webserver quickly. My goal is to recover these data with memcached and update to my flask template
mc = memcache.Client(['127.0.0.1:11211'], debug=0)
app = Flask(__name__)
def updateH():
state = mc.get("wc_h")
if state:
return "yes.png"
else:
return "no.png"
def updateF():
state = mc.get("wc_f")
if state:
return "yes.png"
else:
return "no.png"
@app.route('/')
def index():
return render_template('index.html', hstate = updateH(), fstate = updateF())
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
app = Flask(__name__)
This work perfectly but I'm forced to reaload the page to update visual data.. (img src in my case) Sorry for my english. Thx
Aucun commentaire:
Enregistrer un commentaire