Does the test client execute javascript as well ? I can't remember.

On 05/06/18 00:14, Bernd Wechner wrote:
Thanks Melvyn, looks exactly like what I wanted! Will investigate. I had a feeling this could not be a novel or unique use case.

Regards,

Bernd.

On Monday, 4 June 2018 20:09:25 UTC+10, Melvyn Sopacua wrote:

    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
    
<https://docs.djangoproject.com/en/2.0/topics/testing/tools/#the-test-client>...
    if your template uses request related information (like logged in
    user). The cheaper method is something like this code
    
<https://github.com/melvyn-sopacua/django_xtc/blob/master/xtc/__init__.py#L49>,
    but this only renders the template and you'd have to provide a
    context so view code is bypassed.

--
    Melvyn Sopacua

--
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 <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto: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/850bfcaa-0518-48ef-a827-087100efda92%40googlegroups.com <https://groups.google.com/d/msgid/django-users/850bfcaa-0518-48ef-a827-087100efda92%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
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/03b51b49-d1b8-b7f4-9ff4-5d8d8ff3b54a%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to