Hey!

I recently started reading the (narrative) documentation of pyramid; things
were going smooth until I came across the URL dispatch chapter.

Before reaching the chapter, I created a sample new project using a
'starter scaffold' as outlined in 
http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/project.html
I started the server as instructed and saw the default pyramids page
which came with the project 
(http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/_images/project-debug.png)

When I reached the URL dispatch chapter, I came across this piece of
code which confused me:

# "config" below is presumed to be an instance of the# 
pyramid.config.Configurator class; "myview" is assumed# to be a "view callable" 
functionfrom views import myviewconfig.add_route('myroute', 
'/prefix/{one}/{two}')config.add_view(myview, route_name='myroute')


Since I had been adding routed in the __init__.py of the package, I 
went ahead and added these lines of code in my __init__.py which
looked like this before adding:

from pyramid.config import Configurator
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.    """
    config = Configurator(settings=settings)
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('home', '/')
    config.scan()
    return config.make_wsgi_app()


However when I incorporated the former lines of code
into the original __init__.py above, the server gave an error and
stopped running. This was even after following what the URL
dispatch page had asked to change views.py. According
to the error shown on the command line, the problem seems
to be rooted at changed made to __init__.py

Anyone know a way out of this?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-devel/-/1bbC8qNIwJsJ.
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