
This probably isn't the proper way to do it, but it should work: root = resource.Resource() root.putChild('terms', Terms()) root.putChild('profile', Profile()) root.putChild('', IndexPage()) On Wed, Mar 14, 2012 at 5:46 AM, Lusana Ali <ali.lusana@gmail.com> wrote:
Hi,
Im trying to setup just a very simple site using a Resource Tree (some code below). The problem I'm having is getting the root / to render. so when i go to domain.com/ I get "No Such Resource No such child resource"
The child nodes {terms,profile} are rendering fine. So looking at the resource tree and the main.py which holds the Main() Resource... how can I fix this issue. I have already tried setting isLeaf = True in Main() but that breaks terms and profile
Cheers
server.py ======================================= # resource tree root = Main() root.putChild('terms', Terms()) root.putChild('profile', Profile())
site = server.Site(root) reactor.listenTCP(6346, site) reactor.run()
main.py ======================================= class IndexPage(Resource):
def __init__(self): print "created new index page" Resource.__init__(self)
def render_GET(self, request): print "rendering get" return "<html>INDEX PAGE</html>"
class Main(Resource):
def get_child(self, name, request): print "trying to get main" return IndexPage()
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Jasper