Created
February 14, 2012 19:28
-
-
Save jvanasco/1829464 to your computer and use it in GitHub Desktop.
akhet init file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
config.include("pyramid_beaker") | |
# Templates ending in ".html" should be rendered with Mako. | |
config.add_renderer(".html", "pyramid.mako_templating.renderer_factory") | |
# Configure subscribers | |
# Akhet's .subscribers.py starts you off with 2: URL generator, renderer globals. | |
config.include(".subscribers") | |
# Add routes and views. | |
# the core Akhet library provides a sample route and view | |
# including this here runs the includeme() function in akhet.py which sets them up | |
config.include("akhet.pony") | |
# 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 | |
config.scan(".views") | |
# Add static route to overlay static directory onto URL "/". | |
# including the akhet.static module will instruct pyramid how to configure the overlay | |
config.include("akhet.static") | |
# 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