Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django + Google App Engine: app engine helper for django or use_library?

There seem to be 2 ways to use django 1.1 with GAE

  • Google App Engine helper for django
  • The new use_library() function

We currently use the first. Should we switch? And what's the difference between the two?

like image 916
Paul Biggar Avatar asked Jan 08 '10 17:01

Paul Biggar


2 Answers

use_library loads an unpatched version of django in the production environment, so many things will not work out of the box on app-engine.

The helper applies a series of patches to the django libraries to enable things like Sessions, test, cache framework, etc. If you do not add your own copy of django into your helper application and you are using the latest release (r100 or higher), the helper first tries to load django 1.1 and if it does not succeed then loads 1.0. You can see this in appengine_django/__init__.py::LoadDjango.

On production GAE, django 1.1 always exists, so it is loaded first.

However, on your development environment the dev server SDK does not distribute Django. Therefore, it uses whatever version of Django it can find, first trying 1.1 and then 1.0 and if it cannot find one then throws UnacceptableVersionError.

You probably want to use the helper and not use_library because then you will need to patch the raw django libraries yourself, thus duplicating the work in the helper. Whether you distribute your own version of django, either as a folder or zip file is up to you. One of the advantages of not distributing your own copy of django is that as google applies security patches you automatically get them without having to redeploy your application.

like image 59
dar Avatar answered Nov 11 '22 00:11

dar


the replacement is called django-nonrel (and djangoappengine)... you can find it at http://www.allbuttonspressed.com ... with django-nonrel, you should be able to run pure Django apps on top of App Engine without tweaking your models!

like image 41
wescpy Avatar answered Nov 11 '22 00:11

wescpy