19

How much of a pain is it to run a Django App on App Engine? Also, does the Datastore work as-is with Django?

7 Answers 7

13

I spent some time trying to answer the same question... it seems to me that the most difficult thing to transfer to GAE are django's models... in the sense that they require various modifications and rethinking, mainly because GAE's backend is not a standard relational DB, but google's BigTable. I found a nice intro to this here:

http://www.youtube.com/watch?v=rRCx9e38yr8

Anyways, it's worth downloading one of those 'patches' and have a go with it!

For me the best solution is the 'app-engine-patch'. I downloaded the sample project and it worked straightaway! (Mind that you need to have GAE's SDK installed separately) A killer-feature for me is the fact that the django-admin and many other classic django functionalities have been ported too!!!

http://code.google.com/p/app-engine-patch/

The documentation is still quite minimal in my opinion, but it's good enough to get you going. It'll help you to skim though the official GAE docs though!

2
  • 1
    I found the app engine patch to be a PIA. It always looks for some strange python modules, oftentimes returns wierd errors, and functions completely different than django runserver. Dec 2, 2009 at 13:59
  • is this patch better that Django-Nonrel?
    – kagali-san
    Feb 27, 2011 at 20:16
12

Just Yesterday (depending on your time zone), Google released a new SDK for Python on Appengine that supports django 1.0 out of the box.

2
  • Thanks for the pointer! I am also pretty excited about the task queues! Jun 21, 2009 at 9:12
  • I heard that it's only a subset of Django (for example templates) and not the entire framework. Woukld appreciate some clarification. I agree with other posters: Django-norel is a PiTA! Feb 3, 2012 at 13:55
6

You need to use django-nonrel (source).

You will still find loads of issues:

  • Many2Many relations not supported
  • Fake joins increase number of queries
  • App Engine doesn't allow any python lib with socket or C dependencies (sentry, lxml...)

You can try to get early access to CloudSQL.

Otherwise you are not constraint to use App Engine, you can think about using:

Cheaper and more control with support requirement files like pip.

3

31.01.2012, Google released App Engine 1.6.2 that supports Django out-of-the box.

1
  • Do you have to use it with CloudSQL though or can you also go with The HRD Datasotre Jul 9, 2012 at 12:23
1

App Engine includes version 0.96 of Django out-of-the-box, but it is quite crippled.

App Engine Helper and app-engine-patch supposedly fix this problem to some degree, but I haven't tried either myself.

http://code.google.com/appengine/articles/appengine_helper_for_django.html http://code.google.com/appengine/articles/app-engine-patch.html

0

The amount of pain depends on how much existing code you want to reuse. Unfortunately because of the Datastore does not support SQL, you often cannot just take any django-pluggable app and use it on your GAE project.

App-engine-patch http://code.google.com/p/app-engine-patch/ looks to be ahead of the other django helpers in bringing the standard applications (Sites, ContentTypes, Flatpages) over to GAE. I have used app-engine-patch on several gae projects, and once you understand how to port a django-sql model to a django-gae model and converting sql to datastore queries things can be done very quickly - but there is always a learning curve.

appengine-helper tries to bridge the Datastore gap by providing a model so you don't have to change your model superclasses, but I've found that you end up having to change ManyToMany relationships and any sql anyway, so the advantage ends up being minimal. ae-patch has a roadmap to try to provide an ae-datastore backend, but it probably won't happen for a while.

0

Google has now launched their Cloud SQL storage. That is actually MySQL 5.5 in the cloud. IMO that's a very nice way to migrate your Django app into the cloud. They have a free trial up to June 1, 2013.

If you need some tips how to set up your Django project for Appengine and Cloud SQL I've written a tutorial for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.