Open main menu

Wikibooks β

Karrigell/Write the "Hello world" script

< Karrigell

Create a new directory. Save this script in a file called "":

def index():
    return "Hello world"

Create another script called

import Karrigell

Save in the same folder as, then run it : python This will launch the built-in web server.

Finally, in a web browser enter the address http://localhost/ . Congratulations, you just ran your first Karrigell script ! The address requested to run the function index() in the script The value returned by this function is printed in the web browser.

In fact, you could have written the url http://localhost/ : if no function name is specified, the function index() is run by default, with no argument.

And you could even have called http://localhost : if no script is specified, the server searches a script called and if it finds one, it executes its function index().