瓶管理 - 绩效困难(Flask Admin - performance difficulties)

2019-10-19 18:17发布

我对着在烧瓶管理性能问题,虽然瓶应用的性能还是不错的。

我的模型是:

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)
    ...

有真的在很多方面的记录,并在插件等等。 如果我点击任意位置即可在烧瓶联系酒店,期限,CK或附加组件的细节,这是不可能的,因为它没有完成,直到超时。

能不能请您告诉我,我可以改善呢? 谢谢

Answer 1:

启用AJAX外键加载。 在这里看到: http://flask-admin.readthedocs.org/en/latest/api/mod_model/#flask.ext.admin.model.BaseModelView.form_ajax_refs



文章来源: Flask Admin - performance difficulties