Pico

Pico is a very small web application framework for Python.

View the Project on GitHub fergalwalsh/pico

Install

easy_install pico or pip install pico

Write a Python module:

# example.py
import pico

def hello(name="World"):
    return "Hello " + name

Start the server:

python -m pico.server

Or run behind Apache with mod_wsgi

Call your Python functions from Javascript:

<!DOCTYPE HTML>
<html>
<head>
  <title>Pico Example</title>
    <script src="/pico/client.js"></script>
    <script>
        pico.load("example");
    </script>
</head>
<body>
  <p id="message"></p>
  <script>
  example.hello("Fergal", function(response){
    document.getElementById('message').innerHTML = response;  
  });
  </script>
</body>
</html>

What? How?

The Pico protocal is very simple so it is also easy to communicate with Pico web services from other languages (e.g. Java, Objective-C for mobile applications). See the client.py for a reference implementation.

See the wiki for more information.