Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 513e57cbea
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (42 sloc) 1.646 kB
from pyramid.config import Configurator
from pyramid.authentication import SessionAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from sqlalchemy import engine_from_config
from .models import (
DBSession,
RootFactory,
)
def main(global_config, **settings): # pragma: no cover
""" This function returns a Pyramid WSGI application.
"""
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
session_factory = UnencryptedCookieSessionFactoryConfig(
settings['session.secret']
)
authn_policy = SessionAuthenticationPolicy()
authz_policy = ACLAuthorizationPolicy()
config = Configurator(
settings=settings,
root_factory=RootFactory,
authentication_policy=authn_policy,
authorization_policy=authz_policy,
session_factory=session_factory
)
config.add_static_view('static', 'shootout:static')
config.include(addroutes)
config.scan()
return config.make_wsgi_app()
def addroutes(config):
# broken out of main() so it can be used by unit tests
config.add_route('idea', '/ideas/{idea_id}')
config.add_route('user', '/users/{username}')
config.add_route('tag', '/tags/{tag_name}')
config.add_route('idea_add', '/idea_add')
config.add_route('idea_vote', '/idea_vote')
config.add_route('register', '/register')
config.add_route('login', '/login')
config.add_route('logout', '/logout')
config.add_route('about', '/about')
config.add_route('main', '/')
Jump to Line
Something went wrong with that request. Please try again.