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

django, google-app-engine

Solution

`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.

Problem

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?

Original source