My favorites | Sign in
Project Home Downloads Wiki Issues Source
How to get started with Karrigell
Updated Aug 13, 2012 by


Download the package from the downloads page

Unpack it in some directory, then open a console window and in this directory, run

python install

To test that everything works, go to the subdirectory www and run


This will start the built-in server on port 80. If you want another port, edit and change the last line[MyApp])


The server supports IPv6. To specify it, set the option address_family to socket.AF_INET6

Once the server is started, type http://localhost in a browser (or http://localhost:8000). If all went well, a home page is displayed

Click on the link "Login". Since it's the first connection, no user has already been identified, so you should enter a login and password for the administrator

When this is done, the home page prints your login, and there is a link to a users management script

Introduction to scripts

Karrigell scripts are pure Python scripts, run in a namespace prepared by the framework. Requests are managed by functions defined in the scripts : the url http://host/path/ is managed by the function bar of script

The matching between host/path and the directory where the script stands is defined by the application settings (see ApplicationSettings)

An application with several pages can be defined in a single Python script :

head = HEAD(TITLE("Cities"))

def index():
        form = FORM(action="show")
        form <= INPUT(name="city")
        form <= INPUT(Type="submit",value="Ok")
        return HTML(head+BODY(form))
def show(city):
        return HTML(head+BODY(city))

In this simple example, the function index() returns an HTML page with a form to be filled by the user. The attribute action of this form tells the framework to target the function show(), and passes the argument city to this function. Here, the function just echoes the value

The names in uppercase letters (HEAD, FORM, etc) are in the execution namespace : they match all the valid HTML tags and are used to generate HTML code. See HTML Tags for more information

The names defined at the script level are available in all functions : here, the name head can be used in both functions to return the same HTML header with the page title

Sign in to add a comment
Powered by Google Project Hosting