DISQUS

David Cramer's Blog: Tips for Scaling a Web App

  • Julien Phalip · 1 year ago
    Thanks a lot for these tips. Also, I'd be curious to see what that "has_changed" method does. For example, how can you track previous states of the 'city' value?
  • David Cramer · 1 year ago
    On initialization (__init__) you can store the state of things. I may throw up an example here in a few days, the code above doesn't actually match what we use, but it was a quick clean example :)
  • Fernando Correia · 1 year ago
    Very nice article. The tip about using Javascript for the variable part of a page is just great. As all really good ideas, seems obvious in retrospect. Thanks a lot for sharing.
  • Peter · 1 year ago
    User's name (as in “Logged in as David”) can also be stored into the browser's cookie and fetched from the cookie using javascript, such that the Ajax call would be called only if the user name doesn't exist in the cookie.
    This way, you could omit the ajax call in most cases and minimize the load on your server even more.
  • RJ Ryan · 1 year ago
    RE: Denormalisation, there are Django plugins which accomplish the denormalisation you are doing by hand automatically.

    If you do things manually, you're likely to end up with inconsistent data at some point.. django has a signals/slots architecture built into core which you might as well use to do this all automagically.

    http://www.aeracode.org/2008/9/14/denormalisati...
  • David Cramer · 1 year ago
    Yes there are, but there is no need to use signals (extra overhead) when it's a simple task like this.
  • Anonymous · 1 year ago
    Honza's alternative to the silly javascript solution that he suggested at Djangocon is much superior.
  • David Cramer · 1 year ago
    In some situations, yes. We happen to have more than just a username and user id though. We use it to pass other dynamic information pages as well. But the solution is far from silly, and it's a lot more common than you may think.
  • kevin · 1 year ago
    What is Honza's solution?