Examples
Examples source code of Applications built with Oreoweb
Simple Blogger Clone using Oreoweb
App.py
from Oreoweb import App, Templates
from models import db, Post
app = Oreoweb()
@app.route("/")
def index(req, resp):
posts = Post.select()
resp.html = templates.render("index.html", {"posts": posts})
@app.route("/posts/{slug}")
def post(req, resp, slug):
post = Post.select().where(Post.slug == slug).get()
resp.html = templates.render("post.html", {"post": post})
if __name__ == '__main__':
db.connect()
db.create_tables([Post])
app.run()Last updated
Was this helpful?