Django管理员内联的性能降低 [英] Slow performance for Django admin inline

查看:107
本文介绍了Django管理员内联的性能降低的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个django管理站点,用于让非技术人员轻松地将数据插入数据库。

I have a django admin site which is used to let non-tech people insert data into database easily.

我在特定页面内使用内联表单,使人们可以不断插入数据而无需记住外键实例的信息。

I use inline form within a particular page which let people keep inserting data without remembering info of a foreign key instance.

但是,当您在页面上创建了30多个内联实例时,整个页面将变得越来越慢。点击添加其他实例按钮后,我什至要花10秒的时间。表单验证时间也不可接受。

However, when you have created more than 30 inline instances on page, the whole page is getting slower and slower. It even takes me 10 second to wait after I click 'add another instance' button. The form validation time is also unacceptable.

我的问题是,有什么解决方案可以解决这个反应迟钝的问题吗?

My question is that is there any solution to deal with this slow reacting issue?

我认为有两种解决方案:

I think there are two kind of solutions:


  1. 一些技巧可以加快反应速度。

  1. Some tricks can accelerate reacting speed.

放弃内联格式并实施替代解决方案,该解决方案可以帮助人们插入数据而无需记住外键实例ID或名称。

Give up inline form and implement an alternative solution which can help people to insert data without remembering the foreign key instance id or name.

预先感谢。

推荐答案

我会考虑创建一个用于输入数据的单独页面,这样您就不会再负担加载其他模型的开销实例。

I would look at creating a separate page for entering in data so you don't get the overhead of loading the other model instances.

您还可以实现缓存以加快所有查询的速度。

You could also implement caching to speed any queries up.

这篇关于Django管理员内联的性能降低的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆