@app.route('/update')
def update():
for x in range(4):
import writedatabase as h
b=h.pushit(1,1,1)
return redirect(url_for('home'))
以上代码,理论上是写入数据库4条数据,但是实际操作中会写入8条之多。
gunicorn 设置是 -w 4
另外用python自带的运行程序没有问题,感觉和多进程有关。
希望大神帮忙看看如何解决。
另外请教通过网址更新数据库,或者每天自动更新数据库,有没有什么好的方法?