嗨,我正在运行带有postgreSQL数据库的烧瓶应用程序.使用多个worker时,我得到LockErrors.我了解到这是因为嗖嗖搜索会锁定数据库
http://stackoverflow.com/questions/36632787/postgres-lockerror-how-to-investigate
Run Code Online (Sandbox Code Playgroud)
正如在这个链接中所解释的,我必须使用BufferedWriter ...我谷歌周围,但我真的无法弄清楚如何实现它?这是我的数据库设置方面的嗖
import sys
if sys.version_info >= (3, 0):
enable_search = False
else:
enable_search = True
import flask.ext.whooshalchemy as whooshalchemy
class User(db.Model):
__searchable__ = ['username','email','position','institute','id'] # these fields will be indexed by whoosh
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(100), index=True)
...
def __repr__(self):
return '<User %r>' % (self.username)
if enable_search:
whooshalchemy.whoosh_index(app, User)
Run Code Online (Sandbox Code Playgroud)
感谢carl非常感谢
编辑:如果没有能力并行访问烧瓶 - whosshsqlalchemy你有什么选择吗?