On maandag 4 juni 2018 08:00:08 CEST Bernd Wechner wrote:
> Say I have a page on my Django website (because I do) that I would like to
> take a snapshot of on an automated basis on the server itself with a
> crontab say. I imagine writing a small python script that I could run, that
> loads Django, a settings file, knows a URL and has a way of saying "give me
> the rendered page for that URL please" and save it in a file.
...
> a) there's a canonical way to do this already that can be recommended
Yep. The test client ... if your template uses request related information (like logged in user). The cheaper method is something like this code, but this only renders the template and you'd have to provide a context so view code is bypassed.
--
Melvyn Sopacua