2👍
You cannot put that directly into django’s html templating language. You might consider:
- Prefetching the html, store it somewhere and render it to the template.
- Use an ajax call, that triggers a view that does the crawling, then on success you insert your html in the DOM (this is blocking and slow at server-side).
- If you truly want this to be non-blocking, use a non-blocking server. See this code as an example.
Source:stackexchange.com