烧瓶管理员 - 性能困难 [英] Flask Admin - performance difficulties
问题描述
我的模型是:
$我的模型是:Flask-Admin的性能问题,虽然Flask应用程序的性能很好。 b $ b
class Ck(Base):
__tablename__ =ck
id = Column(Integer,primary_key = True,autoincrement = True)
nazev = Column(String(100))
kontakt = Column(Text)
terms = relationship(Term,backref = backref('ck',lazy ='noload'),lazy ='dynamic ')
class Term(Base):
__tablename__ =term
id = Column(Integer,primary_key = True,autoincrement = True)
酒店_id =列(Integer,ForeignKey('酒店.id'))
ck_id =列(Integer,ForeignKey('ck.id'))
...
addons =关系Addon,secondary = term_addon,backref = backref('term',lazy ='noload'),lazy ='dynamic')
$ b $ class酒店(Base):
__tablename__ =hotel
id = Column(整型,primary_key = True,autoincrement = True)
country_ id = Column(Integer,ForeignKey('country.id'))
area_id = Column(Integer,ForeignKey('area.id'))
...
photos = relationship(Photo ,backref = backref('hotel',lazy ='select'),lazy ='dynamic')
terms = relationship(Term,backref = backref('hotel',lazy ='noload'),lazy =动态')
类别插件(Base):
__tablename__ =addon
id = Column(整型,primary_key = True,autoincrement = True)
$ / code $ / pre
$ b $ p有很多记录和更多的附加信息。如果我点击任何地方的酒店,Term,Ck或插件的Flask-Admin的细节,这是不可能的,因为它不会完成,直到超时。
请你能告诉我哪里可以改进?
谢谢 解决方案
启用AJAX外键加载。看到这里: http:/ /flask-admin.readthedocs.org/en/latest/api/mod_model/#flask.ext.admin.model.BaseModelView.form_ajax_refs
I am facing to performance problem in Flask-Admin, although performance of Flask application is good.
my model is:
class Ck(Base):
__tablename__ = "ck"
id = Column(Integer, primary_key=True, autoincrement=True)
nazev = Column(String(100))
kontakt = Column(Text)
terms = relationship(Term, backref=backref('ck', lazy='noload'), lazy='dynamic')
class Term(Base):
__tablename__ = "term"
id = Column(Integer, primary_key=True, autoincrement=True)
hotel_id = Column(Integer, ForeignKey('hotel.id'))
ck_id = Column(Integer, ForeignKey('ck.id'))
...
addons = relationship(Addon, secondary=term_addon, backref=backref('term', lazy='noload'), lazy='dynamic')
class Hotel(Base):
__tablename__ = "hotel"
id = Column(Integer, primary_key=True, autoincrement=True)
country_id = Column(Integer, ForeignKey('country.id'))
area_id = Column(Integer, ForeignKey('area.id'))
...
photos = relationship(Photo, backref=backref('hotel', lazy='select'), lazy='dynamic')
terms = relationship(Term, backref=backref('hotel', lazy='noload'), lazy='dynamic')
class Addon(Base):
__tablename__ = "addon"
id = Column(Integer, primary_key=True, autoincrement=True)
...
There are really lot of records in terms and much more in addons. If I click to anywhere to get details of Hotel, Term, Ck or Addon in Flask-Admin, it is not possible, because it doesn't finish till timeout.
Please could you advise me where I can improve it? Thank you
Enable AJAX foreign key loading. See here: http://flask-admin.readthedocs.org/en/latest/api/mod_model/#flask.ext.admin.model.BaseModelView.form_ajax_refs
这篇关于烧瓶管理员 - 性能困难的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!