5 ms·
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 c
by Kilimanjaro 16y ago
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.