Skip to content

Instantly share code, notes, and snippets.



Created Feb 14, 2012
What would you like to do?
akhet init file
from pyramid.config import Configurator
import pyramid_beaker
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
config = Configurator(settings=settings)
# initiate Beaker sessions and caching.
# configuration is in your environment.ini file
# Templates ending in ".html" should be rendered with Mako.
config.add_renderer(".html", "pyramid.mako_templating.renderer_factory")
# Configure subscribers
# Akhet's starts you off with 2: URL generator, renderer globals.
# Add routes and views.
# the core Akhet library provides a sample route and view
# including this here runs the includeme() function in which sets them up
# this generated Akhet scaffold starts you off with some sample views as well
# you must first add a route...
config.add_route("home", "/")
# and then, scanning this will look for @view_config in the package and register it with routes
# Add static route to overlay static directory onto URL "/".
# including the akhet.static module will instruct pyramid how to configure the overlay
# you then add the route , along with the cache time
config.add_static_route("akhet_demo", "static", cache_max_age=3600)
return config.make_wsgi_app()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.