A python web framework for google app engine
(Please note that this question and some of the answers are old)
I want to use an existing python framework to develop an application on google appengine.
It shoul开发者_JS百科d be quick and easy to start and support test driven development practices in an easy way.
Can you recommend a stack? What about django?
Additional Information:
There are several django ports, but the stackoverflow questions are already old. There were several django/appengine solutions, I do not know which one is currently leading. (This is now outdated, see accepted answer and also the other answers).
But also other frameworks are interesting, not only django.
What also sounds good but is not a condition is the possibility to run the app on the framework and the appengine and maybe later run it on a self hosted (noSql-) version of this framework (which maybe could be django, or maybe somehting else).
UPDATE: This answer is now out of date.
For me the choice is djangoappengine.
It's a fork of the django project made specifically for no-sql databases like Google App Engine and MongoDB. The main benefit of it is that you get to piggy-back on all the cool stuff coming out of the django project, while also running on GAE's scalable architecture. Another benefit is that with djangoappengine, you can more easily move off of App Engine than if you used their API directly (although that is probably easier said than done).
There were rumors that Django would merge the changes into the mainline Django project, but it has not happened yet (as of May 2014).
Some relevant links:
- Docs
- GitHub
- Discussion group
I personally have enjoyed using Flask on App Engine using this template: https://github.com/kamalgill/flask-appengine-template
The code is organized pretty well in this template and it includes many of the nice development features like profiling and app stats.
If you want to build large scale application and need a more flexible framework, then you can take a look at
Pyramid Python Framework
Previously it was called Pylons
. There are lot of good companies using this framework.
You can find instructions for the process of deploying it to appengine on their website: http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/gae_buildout.html The process uses buildout and also includes a local testing environment.
I'm very happy with this boilerplate:
https://github.com/coto/gae-boilerplate
Take a look at its functions and features, it's very complete!
(Note that this answer is old and no longer valid.)
After reading Tom Willis' comment on the question and also this SO question's accepted answer I noticed that webapp/webapp2 looks promising.
- There's some level of commitment from google
- It is not necessary to create and maintain own versions for existing SDK handlers
- There are libraries that were created with App Engine in mind which are based on webapp and would need a port or adapter to work with other frameworks
- It can be used outside appengine
- Unit testing is easy to setup and documented here
I am enjoying
http://ferris-framework.appspot.com/
which was written specifically for GAE. I love Django in general, but not for gae, I felt using django-nonrel still requires too many caveats that it is not worth it.
I wrote GAEStarterKit, which aims to get you up to speed as quickly as possible. It's in a similar vain to projects like GAE-Boilerplate or gae-init, but a few key differences:
- First and most obvious, I used UIKit over HTML5 Boilerplate. Boilerplate is a great choice, and obviously is popularity comes with perks, but for the purposes of getting started quickly, I find uikit a bit more "complete."
- I put a lot of work into making sure the user login/registration system is as well-thought-out as possible. Users can have multiple email addresses, multiple authentication methods, and be associated with multiple tenants, if applicable. The social login side for non-Google users is done via Authomatic, which is a great project and very well-supported.
- Although it's a little rough around the edges, I did something pretty similar to Django's GenericViews, but in Flask and with GAE Models. I used WTForms integration for that, so it all works pretty well out of the box. It's certainly not perfect, but it's pretty good.
- I really took seriously the idea of not repeating myself. For example in gae-init, you'll find a lot of CRUD code. For the admin side, you can add a model to your admin GUI in GAEStarterKit with one import, and one function all.
Might be worth considering.
精彩评论