News for hackers. Stuff that matters.
Re:Why we’re really happy with AppEngine (and not going anyw... by Kilimanjaro on Tuesday November 23, 2010 @11:35PM (#1936511)
Here is a sample index.py that renders index.html. I enhanced webapp with some utilities to make my life easier, I hate typing in excess.

    import app

    class main(app.request):
      app.session.start()
      data=app.models.getContacts()
      app.render('index',data)

    app.run('/',main)

And here the html in the template:

    <html>
    <body>
      <h1>Contacts List</h1>
      {% for item in data %}
        <li>{{item.name}} - {{item.phone}}</li>
      {% endfor %}
    </body>
    </html>
Some purists will burn me at the stake, but it works wonders for me.

There are no comments on this comment yet.