Django Timelimit

Django-timelimit allows you to wrap sections of Django templates with a
timeout to enforce an upper bound on render time. When the templates exceeds
this time, an alternative fragment is rendered instead:

This is useful in loops where you do not want the total render time to go up
with the number of iterations of the loop.

Caveats

Django-timelimit is based on interruptingcow and so it shares its limitations.
Interruptingcow uses signal(SIGALRM) to let the operating system interrupt
program execution, meaning:

Python signal handlers only apply to the main thread, so you cannot use this
from other threads (this also means you cannot use this in a multithreaded
webserver, or even ones that use a background thread for request handling
(Gunicorn works great).

You must not use this in a program that uses SIGALRM itself (this
includes certain profilers)