A Python web framework that makes the most of the
Simplates are the main attraction.
Aspen automatically sets the
Content-Type response header based
on the file extension of the simplate file being served (you can override this
behavior by setting the header manually in your simplates). Aspen instructs the
module in the Python standard library to use the following mappings to
Content-Type to use for which file extension.
type_mapin your Python installation's
mime.typesfile bundled with Aspen
Later definitions override earlier ones.
Let’s say that you want to use the
.smpl file extension
to denote simplates on your filesystem. You might want to do this because
it’s easier to configure your text editor based on a unique
Create a file named
greetings.smpl with this content:
Now hit it with your browser:You get a
text/plainresponse, because the
.smplextension is unknown to Aspen, and
text/plainis Aspen’s default.
Now put the following line in a file named
mime.types in your
(note the lack of a period before
aspen to pick up the new
and then hit
foo.smpl again. You should now have a rendered HTML