Aspen

A Python web framework that makes the most of the filesystem.
Simplates are the main attraction.

project_root

Aspen can be configured with a project_root directory, a catchall for files that don’t belong in your actual URL hierarchy. Think of it as your site’s junk drawer.

Previous versions of Aspen hard-wired this to a directory named .aspen inside ${website.www_root}, but that was inflexible and people struggled with hidden directories on Mac OS. Even earlier versions used a cleverly-named __ directory as a virtualenv with a UNIX-y userland layout. So conf files were under etc/, modules under lib/python/, and templates under etc/templates/. For reasons of versioning and deployment (most of which were first put into my head by Jim Fulton), it turns out to be better for project_root to be flat.

configuration files

Aspen will read the mime.types file from project_root.

Python modules

The project_root directory is placed on sys.path during startup, so you can place Python modules directly inside of this directory and they will be available to your simplates.

This means that the project_root directory is a lightweight sandbox. It is sufficient as such if Aspen itself is globally installed, and your site doesn’t need more than pure-Python modules. If you don’t want to install Aspen globally (and I don’t blame you), or you have other Python dependencies that have C extension modules, console scripts, or other things that need to be run through distutils before being made accessible to you, then you should use a full virtualenv. In this case I’ve had success using project_root itself as a virtualenv, though you could also locate your virtualenv outside of your site tree.

Template bases and includes

The template page of simplates will look in project_root for base templates for {% extends %} and file snippets for {% include %}. You can specify relative paths there, so if you would like to add a little structure to project_root here you can.

Home