[英]Django Bootstrap form is slow to render, how can I speed up?
I have a large form (20 fields) that is taking forever to block render in Django + bootstrap-toolkit, as it can be seen in the following graphs: 我有一个很大的表单(20个字段),它在Django + bootstrap-toolkit中永远用尽来阻止渲染,如下图所示:
Also see this block breakdown graph. 另请参见此块分解图。
What I've tried... 我尝试过的...
I'm out of ideas and need some outside perspective on how to work around this. 我没有想法,需要一些外部的观点来解决这个问题。
I got it loading much faster by doing the following. 通过执行以下操作,我可以更快地加载它。
I pre-rendered out the form with the zillion block requests. 我用不计其数的请求预渲染了表格。
Opened browser requested the form. 打开的浏览器请求该表格。
Copied the form HTML code. 复制了表单HTML代码。
Created new html file with the pre-render HTML form. 使用预渲染的HTML表单创建了新的html文件。
Changed the 'VIEW''s GET request to use the new pre-rendered form HTML. 更改了“ VIEW”的GET请求以使用新的预呈现表单HTML。 Added CRSF token just inside the form.
在表单内部添加了CRSF令牌。
Response time was reduced from 5 seconds to .50 ms. 响应时间从5秒减少到0.50 ms。
It's important to note you won't be able to use the cache decorated on that view. 请务必注意,您将无法使用该视图上装饰的缓存。 You can use the <% cache %> template tags on the new HTML file with the form.
您可以在具有表单的新HTML文件上使用<%cache%>模板标签。
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.