Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 191615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:21:23+00:00 2026-05-11T16:21:23+00:00

I have a Django view, which receives part of its data from an external

  • 0

I have a Django view, which receives part of its data from an external website, which I parse using urllib2/BeautifulSoup.

This operation is rather expensive so I cache it using the low-level cache API, for ~5 minutes. However, each user which accesses the site after the cached data expires will receive a significant delay of a few seconds while I go to the external site to parse the new data.

Is there any way to load the new data lazily so that no user will ever get that kind of delay? Or is this unavoidable?

Please note that I am on a shared hosting server, so keep that in mind with your answers.

EDIT: thanks for the help so far. However, I’m still unsure as to how I accomplish this with the python script I will be calling. A basic test I did shows that the django cache is not global. Meaning if I call it from an external script, it does not see the cache data going on in the framework. Suggestions?

Another EDIT: coming to think of it, this is probably because I am still using local memory cache. I suspect that if I move the cache to memcached, DB, whatever, this will be solved.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:21:23+00:00Added an answer on May 11, 2026 at 4:21 pm

    So you want to schedule something to run at a regular interval? At the cost of some CPU time, you can use this simple app.

    Alternatively, if you can use it, the cron job for every 5 minutes is:

    */5 * * * * /path/to/project/refresh_cache.py
    

    Web hosts provide different ways of setting these up. For cPanel, use the Cron Manager. For Google App Engine, use cron.yaml. For all of these, you’ll need to set up the environment in refresh_cache.py first.

    By the way, responding to a user’s request is considered lazy caching. This is pre-emptive caching. And don’t forget to cache long enough for the page to be recreated!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django view generating a bunch of data which I want to
I have a Django view that receives POSTs which do not need to have
I have a Django view which reads a CSV file and saves it to
I have a Django project. Given a url, how can I know which view
In my django app, I have a view which accomplishes file upload.The core snippet
I have a Django 'add business' view which adds a new business with an
I have a Django application which sometimes needs to send some data through TCP
I have a Django view which returns an HttpResponse with a special MIME type
I have a django view which uses a template to display a long queryset
I have a Django form which I'm validating in a normal Django view. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.