Hi,
I've been looking to some of the sample applications around and I've never
seen any place where views are placed nearby to routes if they are not in
the same main file.
I'd like to do something similar without having to pass around a
configurator, or passing it around in an elegant way.
I've read about includeme but I still haven't found a way to use it to
obtain what I'd like.
## main.py ##
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
config = Configurator()
if __name__ == '__main__':
config.scan()
# do some other stuff with config
config.scan('views')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
## views.py ##
from pyramid.response import Response
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
config.add_route('home', '/') # <----
@viewconfig(route_name="home")
def home_view(request):
return Response('...')
thanks
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.