I Use This!
Activity Not Available
Analyzed about 1 year ago. based on code collected about 1 year ago.

Project Summary

Welcome to Django-gae-cacheThis project contains Django middleware and Google App Engine application.

MotivationI have few small web application on poor VPS (Virtual Private Server). Because there is everything on single server (Django, MySQL server, static content), I though how to lower server load/save memory/whatever. And this project is a result of my invention.

Using this application, you will save bandwidth, memory and CPU load of your web server, because all static resources will be served with Google App Engine.

Installation InstructionsThese instructions was written for version 1.0.0, but following versions are backward compatible.

Download and installInstall package using distutils:

svn checkout http://django-gae-cache.googlecode.com/svn/trunk/ django-gae-cache
cd django-gae-cache
sudo python setup.py installUpdate your settings.py... and add the middleware and installed apps settings:

# Something long and unpredictable
GAE_CACHE_SECRET_KEY = 'qwertyuiop'

# URL of your google app
GAE_CACHE_URL = 'http://yourapp.appspot.com'

# Turn on/off GAE cache


)Signup for Google app engine... and download Google SDK to your computer.


Configure GAE applicationGo to PACKAGE_DIR/gae-cache, copy _app.yaml to app.yaml and _config.py to config.py In app.yaml, replace YourAppName with name of your Google App Engine application. In config.py, fill SOURCE_URL with name of your site. Also set up SECRET_KEY to the same string, as is settings.GAE_CACHE_SECRET_KEY in your Django application. Also set MEDIA_URL to the same string, as is settings.MEDIA_URL in your Django application. Deploy GAE applicationIn PACKAGE_DIR/gae-cache, run "appcfg.py update ." (appcfg.py is part of GAE SDK, which you downloaded in 3rd step).

Now visit http://yourapp.appspot.com. You should be redirected to your site or see 403 Forbidden (depends on gae-cache configuration). It is OK. Find some existing resource file on your site (http://yourdjangosite.com/media_url/some_file.jpg and call them thru appspot: http://yourapp.appspot.com/media_url/some_file.jpg. Working? Great! UsageCaching mechanism is working out of the box. Immediately after setting up middleware and GAE application, your HTML pages are searched for hyperlinks to static resources and replaced by URL to the same resource using GAE application. On first call of resource, GAE application downloads static resource from your server and save it into memcache. On next request, resource is loaded from memcache, without request to your web server.

Invalidate cacheSometimes you want to change or delete resource. You can invalidate one specific file or whole GAE cache:

from django_gae_cache import api
a = api.Api()

# or
a.InvalidateAll()That's all! You can use that for example in save()/delete() method of your Resource model.

Memcache principeOn GAE application, resources are stored in memcache structures (there is 10GB free quota on GAE, which is enough for middle-size site). Memcache will free the oldest unused resources, when there application need space for newer resource. It means, we don't care of any advanced cache management, because in memcache are the most useful items at every time...

TODOMy web application is far to GAE quota limits, so GAE cache dont have any fallback mechanism yet. It means, that resources are always redirected to GAE and Django dont care, if GAE application is working (GAE is down or over free quota). If you are near to quota limits, it is good idea to enable billing. In near future, I will add some intelligence to Django middleware, which will be able to decide, if resource should be redirected to GAE or not.

CONCLUSIONLet me know, if you are using this GAE cache in your project!


appengine cache datastore django gae memcacche middleware python

In a Nutshell, django-gae-cache...

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    data presented on the Open Hub is available through our API
  • ...
    nearly 1 in 3 companies have no process for identifying, tracking, or remediating known open source vulnerabilities
  • ...
    learn about Open Hub updates and features on the Open Hub blog

30 Day Summary

Mar 16 2016 — Apr 15 2016

12 Month Summary

Apr 15 2015 — Apr 15 2016


Be the first to rate this project
Click to add your rating
Review this Project!