diff --git a/examples/webpy-todo/todo.py b/examples/webpy-todo/todo.py index 9a4db99..d7cfaf1 100644 --- a/examples/webpy-todo/todo.py +++ b/examples/webpy-todo/todo.py @@ -3,15 +3,20 @@ urls = ( "/", "index", - "/healthy", "healthy" + "/healthy", "healthy", + "/ready", "ready" ) +READY = False + app = web.application(urls, globals()) render = web.template.render("templates/") db_url = os.getenv("DATABASE_URL") db = web.database(db_url) +READY=True + def get_todos(): return db.select("todo", order="id desc") @@ -37,5 +42,14 @@ def GET(self): except: web.ctx.status = '500 Internal Server Error' +class ready: + def GET(self): + global READY + if READY: + web.ctx.status = '200 OK' + else: + web.ctx.status = '500 Internal Server Error' + + if __name__ == "__main__": app.run()