On Monday, 4 June 2018 16:00:09 UTC+10, 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. 
>
> On way of course is open port 80 or 443, send an HTTP request and get the 
> HTTP response. But there is probably a better way that leaves the web and 
> UWSGI servers right out of the equation and just runs Django template 
> rendering code or a view itself and nabs the result.
>
> As usual, I'm both confident this is possible and that I'll nut out a way 
> to do it, but am throwing it out there in case:
>
> a) there's a canonical way to do this already that can be recommended
> b) I can save myself some time reading and experimenting if anyone whose 
> done this already shares their experience
>
> I will raise the bar one on the original question while I'm here, and 
> raise the spectre of autorun on page load javascript that the page may 
> have. Makes it hairier by a step. But it's not unusual for javascript to do 
> some rendering on page load - I have a page or two like that ;-), In that 
> case neither of these strategies are likely to work and either one might if 
> coupled with what would basically need to be, a rendering engine like 
> mozilla's. Does Python offer that I wonder, a way to pump a response (with 
> embedded Javascript) into a rendering engine and then save (or request) the 
> rendered page?
>
> Kind regards,
>
> Bernd.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81c34e1c-71af-4a43-9e3b-088b3b1383fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to