3

According to this question:

Django on Google App Engine

The easiest way to get started with GAE/Django is with the Django non-rel bundle. However now that the latest Python/GAE SDK includes a build of Django, do we still need this?

What's the best-practice for getting started wth Django on GAE right now?

Thanks

Community
  • 1
  • 1
Salim Fadhley
  • 22,020
  • 23
  • 75
  • 102

2 Answers2

3

Update: It seems that Web app2 is the easiest choice for new projects.

This guest article suggests that

"App Engine does come with some Django support, but this is mainly only the templating and views."

non-rel is still seemingly your best bet. Although I'd caution you that further development and/or maintenance may not happen according to their blog.

kush
  • 979
  • 1
  • 15
  • 32
  • I've yet to see anybody strongly endorsing this product - I'm wondering if Django might not be the best choice for a GAE app. – Salim Fadhley Jan 30 '12 at 15:00
  • 1
    I agree. App Engine team [recommended](http://code.google.com/appengine/articles/appengine_helper_for_django.html) it for existing Django applications as of November 2010. Things have changed since. – kush Jan 30 '12 at 15:35
  • I know SO frowns on "which is best" type questions, but would you care to nominate your peferred app framework for a GAE application? (in Python of course). – Salim Fadhley Jan 30 '12 at 15:43
  • 2
    [Some choices you might be aware of](http://code.google.com/p/tipfy/wiki/AppEngineFrameworks) Is it a new application or an existing one? – kush Jan 30 '12 at 16:46
  • It's new. I used to do some Django work and found it very easy outside of GAE. Through the lens of GAE it seems a hassle and mostly redundant. – Salim Fadhley Jan 30 '12 at 23:00
  • Tipfy looks neat (apart from the bit about no longer being supported!) – Salim Fadhley Jan 30 '12 at 23:02
  • and tipfy seems to recommend... [webapp2](https://webapp-improved.appspot.com/) while they search for a new maintainer? – kush Jan 31 '12 at 03:33
  • I've been coming round to the same conclusion - Webapp2 seems to be suffiently complete & easy to learn as to (mostly) make Django & others redundant. – Salim Fadhley Jan 31 '12 at 09:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/7200/discussion-between-kush-and-salim-fadhley) – kush Jan 31 '12 at 14:10
3

Normal Django's models doesn't have a backend supporting GAE's datastore. Hence you can't use Django models, and hence, Django's model forms. What you'd have to do use use models derived from GAE's python db.Model(). Instead of using Django's ModelForm class for forms, you would use google.appengine.ext.db.djangoforms. Note, that's specifically for ModelForms, other forms work fine since they're not tied to the database.

I can think of two good reasons to use Django-nonrel: 1a) you have a existing project on Django. Using Django-nonrel would be the laziest way to go. Rewriting models to GAE's models isn't too hard, but it could be a small pain, especially if 1b) you use a lot of existing Django components, and you'd have to go through all of them to update the models and forms. 2) You want to hedge your bets against GAE. Using Django-nonrel will allow you to switch over to MongoDB with very little effort, since Django-nonrel has a functioning MongoDB backend. The current Django-nonrel maintainers seem to be more interested in MongoDB.

Having worked with Django-nonrel, I've so far run into some reasons why it may be a bad choice: 1) No support for ancestor queries. There's an outstanding pull request for this though. It won't be compatible with any other DB backend though. 2) ndb is coming out, and seems like it'll have a few more benefits, that likely won't see support on Django-nonrel.

If you do use GAE's native db API, the main benefit from Django would be the form validation. Otherwise, webapp2+jinja2+gae db.Models() would provide similar functionality to Django.

dragonx
  • 14,963
  • 27
  • 44
  • i found this answer to be more correct than the selected one. it represents my experience in trying (and then ditching) django on appengine. It's hard to get any benefits from appengine if you don't drink the appengine koolaid. merely trying to abstract it away just wont work. – Tom Willis Aug 13 '12 at 03:19