def get_app(global_config, **settings): ConfigurationWrapper.init('admin', **settings) config = Configurator(settings=settings) config.include('pyramid_jinja2') config.add_static_view('admin_sstatic', 'admin:static', cache_max_age=3600) config.add_static_view('core_static', 'core:static', cache_max_age=3600) config.add_route('index', '/') config.add_route('answers', '/answer') config.add_route('answer', '/answer/{answer_id}') config.add_route('forms', '/form') config.add_route('form', '/form/{form_id}') config.add_route('bindings', '/form/{form_id}/place') config.add_route('binding', '/form/{form_id}/place/{place_id}') config.add_route('place', 'place/{place_id}') config.add_route('user', '/user') config.add_route('user_permissions', '/permissions') config.scan() config.set_default_permission(Permissions.Auth) config.set_authentication_policy(CookieAuthenticationPolicy()) config.set_authorization_policy( AuthorizationPolicy(ConfigurationWrapper.get_auth('admin'))) """config.add_forbidden_view(lambda r: HTTPTemporaryRedirect('/admin'))""" config.add_notfound_view(lambda r: HTTPTemporaryRedirect('/admin')) return config.make_wsgi_app()
def get_app(global_config, **settings): ConfigurationWrapper.init('api', **settings) config = Configurator(settings=settings) config.include('api.auth_api', route_prefix='/auth') config.include('api.users_api', route_prefix='/users') config.include('api.permissions_api', route_prefix='/permissions') config.include('api.form_api', route_prefix='/form') config.include('api.places_api', route_prefix='/place') config.add_notfound_view(not_found_view) config.add_forbidden_view(forbidden_view) config.add_exception_view(exception_view) config.set_default_permission(Permissions.Auth) config.set_authentication_policy(HeaderAuthenticationPolicy()) config.set_authorization_policy( AuthorizationPolicy(ConfigurationWrapper.get_auth('api'))) return config.make_wsgi_app()
def get_app(global_config, **settings): ConfigurationWrapper.init('map', **settings) config = Configurator(settings=settings) config.include('pyramid_jinja2') config.add_static_view('map_static', 'map:static', cache_max_age=3600) config.add_static_view('core_static', 'core:static', cache_max_age=3600) config.add_route('index', '/') config.add_route('enter', '/enter') config.add_route('exit', '/exit') config.add_route('anketa', '/anketa') config.add_route('xXx_PRO100anketka228_xXx', '/xXx_PRO100anketka228_xXx') config.add_route('choose', '/choose') config.add_route('registration', '/registration') config.scan() config.add_notfound_view(lambda r: HTTPTemporaryRedirect('/')) config.set_default_permission(Permissions.Null) config.set_authentication_policy(CookieAuthenticationPolicy()) config.set_authorization_policy(AuthorizationPolicy(ConfigurationWrapper.get_auth('map'))) return config.make_wsgi_app()