I am so starving: Web app in python frameworks.
By : Shabda Raaj
I have written the same web app in various web frameworks. Get it from Github.
Copied from the Readme.
This is a set of apps which creates the same application in various Python web micro-frameworks.
The app(s) talks to Facebook, and finds out recent people who have posted a public status with the text "so starving".
This idea came from reading Onion.
We have the same app in these frameworks.
Microframeworks:
Full stack frameworks:
If the framework included template engine and caching, that was used directly. Otherwise werkzeug cache and Jinja2 templates were used.
Next step: Write a simple blog engine in these various Frameworks.
Related Posts
- __new__() in python
- Introduction to Python Workshop on February 15th, 2013
- Metaclass in Python
- Understanding '*', '*args', '**' and '**kwargs'
- Understanding decorators
Can we help you build amazing apps? Contact us today.
Very nice! Would you add a web2py example too? I just made it:
Controller:
import urllib
from gluon.contrib.simplejson import loads
def index():
endpoint='http://graph.facebook.com/search?q="so%20starving&type=post'
def get_data(): return loads(urllib.urlopen(endpoint).read())['data']
data = cache.ram(endpoint,get_data,30*60)
return dict(data=data)
template:
{{extend 'layout.html'}}
{{ for post in data: }}
{{=post['message']}} : {{=post['from']['name']}}
{{ pass }}
(assuming it is ok using the default layout.html)
It is [running here](http://web2py.com/fmld) and the source code is here [as a zip](http://web2py.com/fmld/static/fmld.zip) or [as a w2p](http://web2py.com/fmld/static/web2py.app.fmld.w2p).