烧瓶管理员 - 性能困难

时间:2014-04-06 13:45:30

标签: performance flask flask-sqlalchemy flask-admin

我在Flask-Admin中面临性能问题,尽管Flask应用程序的性能很好。

我的模特是:

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

在插件中有很多记录和更多内容。如果我点击任意位置以获取Flask-Admin中的Hotel,Term,Ck或Addon的详细信息,则无法进行,因为它在超时之前无法完成。

请你告诉我哪里可以改进它? 谢谢

1 个答案:

答案 0 :(得分:3)