On Feb 28, 5:41 pm, Chris McDonough <chr...@plope.com> wrote:
>
> You can't mic view_config with add_view.  Instead use view_config with a
> scan:
>
> from wsgiref.simple_server import make_server
> from pyramid.config import Configurator
> from pyramid.view import view_config
>
> @view_config(renderer='json', route_name='create_account')
> def hello_world(request):
>     return {'content':'Hello!'}
>
> if __name__ == '__main__':
>     config = Configurator()
>
>     config.add_route('create_account', '/create')
>     config.scan()
>
>     app = config.make_wsgi_app()
>     server = make_server('0.0.0.0', 8080, app)
>     server.serve_forever()
>

Thanks Chris, that works perfectly.

It just makes me wonder how you'd use the examples at
http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/renderers.html
because none of them have routes defined in the view_config decorator.
Is there a way to add a route to a view_config-decorated view when the
view doesn't have a route name?

--
Ben Sizer

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to