Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » [OFF-Topic] Cache django and get server datetime with a lighter approach [RSS Feed]

#1 Dec. 17, 2010 10:57:13

Michel T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[OFF-Topic] Cache django and get server datetime with a lighter approach


Hi guys,

I'm working on a group buying website like groupon. This page have a
regressive counter that tells the user how many time is available
before the end of the deal publishing.

I want to cache this site: I want to put nginx to serve memcached
directly and only when the page is not found in the memcached, go to
django. I already did it on another project and it worked very well.

The problem here is the current time of the server, caching the site
will broke the regressive counter function.

I planning to cache all the site but the server datetime. I will serve
the datetime as a javascript file and use it on a javascript function,
this way, the cached homepage can refer to the not cached javascript
file.

What do you suggest me? Is django too expensive to serve this datetime
or may I use another scripting language directly from nginx, Maybe PHP
or Perl?

Thanks for any advice!

--
Michel Sabchuk

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 17, 2010 12:39:46

Javier G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[OFF-Topic] Cache django and get server datetime with a lighter approach


On Fri, Dec 17, 2010 at 5:57 AM, Michel Thadeu Sabchuk
<miche...@gmail.com> wrote:
> What do you suggest me? Is django too expensive to serve this datetime
> or may I use another scripting language directly from nginx, Maybe PHP
> or Perl?

PHP/Perl are at least on the same order of magnitude as Python/Django.

If you want to mix nginx-cached content and dynamic content at the
same time, you have to use nginx's SSI (server side includes), there's
an example very similar to your case in nginx website.

in short, you write a small template that includes most of the content
from one (internal) URL and the most variable part from another one.
initially both pieces would be handled separately, calling whatever
handler is registered (likely Django), but each piece would be cached
separately, so only the most variable part would keep calling the
backend scripts.

--
Javier

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » [OFF-Topic] Cache django and get server datetime with a lighter approach [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support