Find file
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (24 sloc) 671 Bytes
layout title
Hello World!

Hello World!

Other languages : français | ...


How to write hello world with


import web

urls = ("/.*", "hello")
app = web.application(urls, globals())

class hello:
    def GET(self):
        return 'Hello, world!'

if __name__ == "__main__":

###Tip: Make url ending with or without '/' going to the same class.

add the following to the beginning of urls.

'/(.*)/', 'redirect', 

and have the following class to handle those urls.

class redirect:
    def GET(self, path):
        web.seeother('/' + path)