Skip to main content

Functional Web Framework

Project description

What is Giotto?

Giotto is a python web framework. It encourages a functional style where model, view and controller code is strongly decoupled.

Key Features of Giotto include:

  • Extremely terse code. A full featured blog application is under 300 lines of code (including templates)

  • Generic views, generic models and multiple pluggable controllers.

  • Free RESTful interface along with your normal “browser POST” CRUD site.

  • Functional CRUD patterns that do away with the need for django-style form objects.

  • Automatic URL routing.

  • Built in cache (supports Redis and Memcache, and an API for supporting any other engines)

  • SQLAlchemy for database persistence.

  • Jinja2 for HTML templates (with an API for extending for other template engines)

Getting started

Install and create base project files:

pip install giotto
mkdir demo
giotto --http

Now your project is initialized. Open the manifest.py and add the following:

from giotto.programs import ProgramManifest, GiottoProgram
from giotto.views import jinja_template, BasicView

def multiply(x, y):
    x = int(x or 0)
    y = int(y or y)
    return {'x': x, 'y': y, 'result': x * y}

manifest = ProgramManifest({
    'multiply': GiottoProgram(
        model=[multiply],
        view=BasicView(
            html=jinja_template('multiply.html'),
        ),
    ),
})

Now create a file called multiply.html:

<!DOCTYPE html>
<html>
    <body>
        {{ data.x }} * {{ data.y }} == <strong>{{ data.result }}</strong>
    </body>
</html>

Or if you’re too lazy to make a template, set the view keyword argument to just BasicView() to use the generic view.

Run the development server:

$ ./http --run

Point your browser to http://localhost:5000/multiply?x=3&y=3. Additionaly, try http://localhost:5000/multiply.json?x=3&y=3. You can also invoke your multiply program through the command line:

$ giotto --cmd
$ ./cmd multiply --x=4 --y=2

Also:

$ ./cmd multiply.html --x=4 --y=2

You can also use positional arguments:

$ ./cmd multiply/4/6

Links:

  • To discuss Giotto, please visit the Google Group

  • Read Giotto’s documentation.

  • Check out giottoblog, a full featured blog application written with the Giotto framework.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

giotto-0.9.12.tar.gz (22.8 kB view details)

Uploaded Source

File details

Details for the file giotto-0.9.12.tar.gz.

File metadata

  • Download URL: giotto-0.9.12.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for giotto-0.9.12.tar.gz
Algorithm Hash digest
SHA256 b5beb785982f411ce0e87b57e41f8dd29ba1942d0df2d23cc88f3dd80edc0ced
MD5 3e7549e3311092a3d1d50be75f6323ec
BLAKE2b-256 6dc4b2a391d6bd8e2ec5c02b090388193dc7be4603f97e5cd25483cdc79f51ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page