> i have cache enabled on a few heavy statistical views.
> I would like to generate the pages before a user goes to that page and maybe
> even
> regenerate the pages every hour to avoid the initial delay.
> However, i can't seem to automate the caching as my site's authentication
> gets in the way
> of automating this.
>
> I've tried code that i googled that performs a cookie based login
> using urllib and urllib2 but that didn't work.
>
> Basically, i would need a view that is started when the server starts and
> gets called
> every hour to generate or visit the url of the stats page.
> And this would have to be via a logged in user as otherwise access to the
> stats is forbidden.
Hi,
is the statistics user-dependent?
If not, just create a cron job (or similar, depending on your
platform) that will calculate the statistics every hour and maybe even
create the main blocks of the page to be displayed.
You can either create a custom management command to do this or
write a script that uses ORM (and templating system) and Django cache.
It very much depends on you setup, but should not be too difficult.
Basically, you probably don't need a "view" to populate the cache.
HTH
Jirka
P.S. http://docs.djangoproject.com/en/dev/howto/custom-management-commands/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.