python - Pyramid Web Framework 1.6 - Simple multi page website -


hello have started try out pyramid 1.6a im trying create multipage site try , used framework. not sure im doing wrong cant page render such 0.0.0.0:1234/another-url can 0.0.0.0:1234/. below starter created using pcreate -s starter ,

__init__.py     pyramid.config import configurator       def main(global_config, **settings):         """ function returns pyramid wsgi application.         """         config = configurator(settings=settings)         config.include('pyramid_chameleon')         config.add_static_view('static', 'static', cache_max_age=3600)         config.add_route('a', '/')         config.add_route('b', '/b')         config.add_route('c', '/c')         config.scan()         return config.make_wsgi_app()       views.py         pyramid.view import view_config     pyramid.renderers import render, render_to_response     pyramid.response import response     pyramid.config import configurator       class myview(object):         def __init__(self, request):             self.request = request           @view_config(route_name='edit')         @view_config(route_name='change')         def edit(request):             return response('edited!')            @view_config(route_name='a', renderer='templates/mytemplate.pt')         def a(self):             self.title = 'oliver test a'             return {'project': 'a'}           @view_config(route_name='b', renderer='templates/mytemplate.pt')         def b(self):             self.title = 'oliver test b'             return {'project': 'b'} 

you can access routes have defined:

    config.add_route('a', '/')     config.add_route('b', '/b')     config.add_route('c', '/c') 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -