7 ms·
Ask HN: Best Python Framework for Google App Engine?
following up on http://news.ycombinator.com/item?id=2715108, what are people using as a python framework?
- kenneth_reitz 15y agoFlask. Docs: http://flask.pocoo.org/ http://flask.pocoo.org/
- tghw 15y agoSeconded. We used the flask-appengine-template (https://github.com/kamalgill/flask-appengine-template https://github.com/kamalgill/flask-appengine-template) and it's been great so far. Flask and Jinja2 make views and templates really easy, and the AppEngine data store fits well for the models.
- jbaker 15y agoI will third and fourth Flask for App Engine. For me, it strikes exactly the right balance between light-weight, flexible, and powerful.
- cageface 15y agoAgreed. I'm more of a Rails/Sinatra guy but if I had to write something for app engine I'd definitely start with Flask.
- djtidau 15y ago+1 for Flask here. The documentation especially is on another level. A lot of commitment here with an active developer community.
- deleted 15y ago[deleted]
- jdq 15y agoIt's going to be hard to get the 'best' framework, but you'll certainly get a lot of responses of frameworks that definitely work for people. I'll add: Tornado http://www.tornadoweb.org http://www.tornadoweb.org
- dfrankow 15y agoThe most often mentioned is Django. We picked Tornado (tornadoweb.org) because it is lightweight and fast, especially on cold start, which is an app engine issue for low-traffic apps. It's even faster than webapp (!) because webapp loads the Django templating system. We've been happy with Tornado, although it doesn't have as much support for some stuff (e.g., web forms). It does have a templating language which is just embedded python. I like having the power to have a reasonable "if" statement or "for" loop, even though most people believe that embedding complex logic in templates will produce spaghetti. See also http://stackoverflow.com/questions/70913/which-python-framework-is-best-for-web-development-in-google-app-engine/3977237 http://stackoverflow.com/questions/70913/which-python-framew... and http://www.quora.com/What-is-the-best-Python-Web-Framework-that-runs-on-Google-Appengine-AND-on-dedicated-servers http://www.quora.com/What-is-the-best-Python-Web-Framework-t...
- jaaron 15y agoThe real answer is "anything but Django." Django is a great framework, but not for GAE. I've used tipfy.org
- endtime 15y agoWhy is Django(-nonrel) a poor choice for GAE?
- olifante 15y agoYou said it yourself. The Django ORM is designed for relational databases. Django-nonrel seems to work, but it's a second-class citizen in the Django world. Much of the appeal of Django resides in the ecosystem of pluggable apps, and most of them won't work or will fail subtly when running on GAE.
- endtime 15y agoOkay, fair point about the third party apps. But even without them, it's not obvious to me that writing a Django-nonrel app from scratch is the worst option available.
- Kilimanjaro 15y agoNone. Just use webapp and you'll be happier, and faster.
- mikemaccana 15y agoWe use django, but yes, google only officially support webapp and you may end up having to translate docs from appengine entities to django objects.
- amirshim 15y agoAt both http://albumpl.us http://albumpl.us and http://jaavuu.com http://jaavuu.com we use webapp plus pytenjin: http://www.kuwata-lab.com/tenjin/pytenjin-users-guide.html http://www.kuwata-lab.com/tenjin/pytenjin-users-guide.html In addition, we have a small home-grown framework ("glue") that holds it together, but it's probably only about 100-200 lines of code. The advantage is that we know it and can maintain/add features easily. But then again we don't really need a low end CMS, which is what many of these other frameworks try to provide.
- Kilimanjaro 15y agoBtw, we use webapp with some sugar on top to make it sweeter: import app class Index(app.request): def get(self): self.show('index') app.run('/',Index) No framework in the whole world can make coding in AppEngine that easy.
- badragon 15y agoTipfy
- nixarn 15y agoAgreed. Tipy is awesome! http://www.tipfy.org/ http://www.tipfy.org/
- delsarto 15y agoYes, but the documentation is a little out of date as the current version has changed significantly. Basically, don't go by anything you find on the web, make sure you use the docs/examples in the mercurial tree
- nmb 15y agoTipfy is nice, but its documentation is horribly out-of-date. The last time I tried using it, I had to dive into the source code several times to figure out what was going on. Eventually I ended up moving off of app engine. (I considered contributing to the docs, but I would have had to spend a lot of time learning the codebase as parts of it had been heavily restructured since the docs were last updated.)
- deleted 15y ago[deleted]
- yanw 15y agoWebapp2: http://webapp-improved.appspot.com/ http://webapp-improved.appspot.com/
- derwiki 15y agoI like Bottle: http://bottlepy.org/docs/dev/ http://bottlepy.org/docs/dev/
- reustle 15y agoI've used bottle for many projects and I'm very happy with it. A new version was just released a few days ago as well.
- olifante 15y agoOne thing that I love about bottle is that it is one of the few web frameworks that supports Python 3 (as does CherryPy, I'm told). Not that it matters one bit if you're running on GAE, which only supports Python 2.5.
- olifante 15y agoone nice thing about the web2py Data Abstraction Layer is that it doesn't have any dependencies. It's just a single file, and it seems to be pretty easy to use with Bottle, which doesn't have any data abstraction layer: http://martin.tecnodoc.com.ar/default/post/2011/05/25/21_bottle-framework-and-web2py-dal http://martin.tecnodoc.com.ar/default/post/2011/05/25/21_bot...
- skudervatchi 15y agobest link to learn java
- ktarnowski 15y agoTornado is great as a standalone API/WWW server, but for WSGI-based environments, like Google App Engine, I would choose Flask (>= 0.7.1) over any other framework. Flask, despite being a micro-framework, is extremely powerful. It's core is well-written and there's a lot of useful extensions out there (like Flask-WTF or Flask-Assets). Flask also works really well with Google App Engine (see example skeleton: https://github.com/kamalgill/flask-appengine-template https://github.com/kamalgill/flask-appengine-template; there's more on GitHub). With little effort you get WTForms and even Webassets support almost out of the box, in really elegant way. Tornado will also do, since it's very similar to webapp and has very good templating system. However, since extensions ecosystem for Tornado is almost non-existent, one has to write more code to make up for it (e.g. integration with Webassets, management commands, OAuth support etc.). There's also Tipfy, but I have absolutely no experience with it, so I can't vouch for it.
- ecaroth 15y agoI have used Tipfy for a couple of projects. It is VERY lightweight and flexible, and comes with jinja2 templating built in. Basically webapp + some missing components, like Session management. It's not even as close to as robust as Django-nonrel for GAE but depending on the scope of your project it might be perfect
- jsdalton 15y agoA nice alternative to the built-in webapp framework is webapp2: http://code.google.com/p/webapp-improved/ http://code.google.com/p/webapp-improved/ It's basically a superset of webapp with some great additions and tweaks.
- moreyes 15y agoThanks for the mention! (I'm the webapp2 author). A big advantage of webapp2 is that you can use existing (and probably future) SDK libraries without adaptation. Many App Engine services (blobstore, mail handler, deferred etc) use handlers made for webapp. With webapp2 you get all those handlers working out of the box with extra benefits: webapp2 is a lot easier to extend and includes the most glaring webapp missing features. Also, you can use all the examples from the App Engine documentation with it, since it is made to be compatible with webapp. And later you learn the new, extended features.
- engblaze 15y agoI'll second this suggestion. In my experience so far, webapp2 is a great way to get beyond some of the stranger idiosyncrasies of the default webapp without being overwhelmed or completely throwing away the benefits of Google's extensive documentation. If you like an extension or modified feature, use it. If not, do the way Google tells you to and it'll work just fine. If you use nothing else, the extended routing functionality and lazy loading of handlers are big improvements and are pretty painless to implement.
- beagle3 15y agoI haven't yet used it on GAE, but web2py is awesome, and works on everything including Jython, CPython, GAE, any database you can throw at it. It is sane, quite easy to use and reasonably fast. web2py is underestimated IMO - give it a try.
- phektus 15y agoI've used web2py on GAE and it's working nicely, with most of the GAE quirks taken into account out of the box. Everything has been taken care of as far as making your app work with GAE is concerned. The site I'm running with web2py + GAE is: http://www.cvstash.com http://www.cvstash.com The web2py author also admitted a few months back in the mailing list that google was paying him to test out the framework against GAE. So I think that means the GAE support would be production-ready at the very least.
- pbreit 15y agoWeb2py has some GAE-specific features to ease installation and operation.
- olifante 15y agoFor reasons that escape me, web2py doesn't seem to get much love, but deploying a web2py app to GAE takes all of 5 minutes. Web2py uses a DAL instead of an ORM, which means it's much easier to use the same data model on the non-relational datastore. (The inevitable restrictions imposed by BigTable still apply, see http://www.web2py.com/AlterEgo/default/show/138 http://www.web2py.com/AlterEgo/default/show/138).
- moreyes 15y agoDoes the web2py database abstraction layer support datastore transactions and query cursors? Or what datastore features it doesn't support? (apparently the documentation doesn't mention any datastore feature it doesn't support but the last time I checked it did not support at least transactions)
- olifante 15y agoI don't know, I haven't had to do transactions. Another advantage of the web2py DAL is that it doesn't have any dependencies. It's just a single file which could be used by any other web framework to decouple from BigTable and enhance portability. An Argentinian developer shows how easy it is to use the web2py DAL with Bottle: http://martin.tecnodoc.com.ar/default/post/2011/05/25/21_bottle-framework-and-web2py-dal http://martin.tecnodoc.com.ar/default/post/2011/05/25/21_bot...
- moreyes 15y agoIt should be added to the documentation which datastore features it doesn't support, to warn users and avoid that the GAE support is misinterpreted as bad advertisement.
- mdipierro1 15y agoYou can use the GAE datastore transaction with the web2py DAL but it does not provide an API with it, you have to use the GAE function for the transaction and than inside you can use DAL syntax. DAL automatically creates one cursor for you per http request. Each request has its own. It does not provide APIs to make your own cursors.