django: guidelines for speeding up template rendering performance

前端 未结 4 1772
太阳男子
太阳男子 2020-12-24 08:59

How would I go about speeding up Django template rendering? My template takes about 1-2 seconds or so to render, after the view function fully computes whatever it needs to.

4条回答
  •  青春惊慌失措
    2020-12-24 09:43

    I would recommend as Step 0 adding to your Django Debug Toolbar an extra panel called Django Toolbar Template Timings. It told me exactly how much time was being spent in each template (block, etc), and how much of that time is in SQL. It's also extra validation that this is your problem.

    Here's how to add a panel to Debug Toolbar. http://django-debug-toolbar.readthedocs.org/en/latest/configuration.html#debug-toolbar-panels

提交回复
热议问题