But when I send a request to:
myserver/static/test.txt
I get a 404 error.
As you can see, I'm not using the default dispatcher. Is it failing
because of that? Should I include some code in my own dispatcher
to call the hooks directly? I don't think so, but I don't know where
this problem comes from.
I'm not used to using a different dispatcher (the object-based one is kind
of awesome), but this is the class I always use for tools.staticdir, maybe
it will help:
class StaticServer(object):
"""For testing - serves static files out of a given root.
"""
def __init__(self, rootDir):
self.rootDir = rootDir
if not os.path.isabs(self.rootDir):
self.rootDir = os.path.abspath(rootDir)
> But when I send a request to:
> myserver/static/test.txt
> I get a 404 error.
> As you can see, I'm not using the default dispatcher. Is it failing
> because of that? Should I include some code in my own dispatcher
> to call the hooks directly? I don't think so, but I don't know where
> this problem comes from.
> Thanks for your help,
> Vincent
> --
> You received this message because you are subscribed to the Google Groups
> "cherrypy-users" group.
> To post to this group, send email to cherrypy-users@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cherrypy-users?hl=en.
> I'm not used to using a different dispatcher (the object-based one is kind
> of awesome), but this is the class I always use for tools.staticdir, maybe
> it will help:
> class StaticServer(object):
> """For testing - serves static files out of a given root.
> """
> def __init__(self, rootDir):
> self.rootDir = rootDir
> if not os.path.isabs(self.rootDir):
> self.rootDir = os.path.abspath(rootDir)
>> But when I send a request to:
>> myserver/static/test.txt
>> I get a 404 error.
>> As you can see, I'm not using the default dispatcher. Is it failing
>> because of that? Should I include some code in my own dispatcher
>> to call the hooks directly? I don't think so, but I don't know where
>> this problem comes from.
>> Thanks for your help,
>> Vincent
>> --
>> You received this message because you are subscribed to the Google Groups
>> "cherrypy-users" group.
>> To post to this group, send email to cherrypy-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> cherrypy-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/cherrypy-users?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "cherrypy-users" group.
> To post to this group, send email to cherrypy-users@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cherrypy-users?hl=en.
Yeah tools.staticdir works kinda weird... the little wrapper class makes it
much nicer
On Oct 29, 2012 10:24 AM, "Vincent Le Goff" <vincent.legoff....@gmail.com>
wrote:
> I think I could serve static content without using the tools.staticdir
> (as you did with your class, I guess). I will check that out.
> Thanks,
> Vincent
> 2012/10/29, Walter Woods <woodswal...@gmail.com>:
> > Hi Vincent,
> > I'm not used to using a different dispatcher (the object-based one is
> kind
> > of awesome), but this is the class I always use for tools.staticdir,
> maybe
> > it will help:
> > class StaticServer(object):
> > """For testing - serves static files out of a given root.
> > """
> > def __init__(self, rootDir):
> > self.rootDir = rootDir
> > if not os.path.isabs(self.rootDir):
> > self.rootDir = os.path.abspath(rootDir)
> >> But when I send a request to:
> >> myserver/static/test.txt
> >> I get a 404 error.
> >> As you can see, I'm not using the default dispatcher. Is it failing
> >> because of that? Should I include some code in my own dispatcher
> >> to call the hooks directly? I don't think so, but I don't know where
> >> this problem comes from.
> >> Thanks for your help,
> >> Vincent
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "cherrypy-users" group.
> >> To post to this group, send email to cherrypy-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> cherrypy-users+unsubscribe@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/cherrypy-users?hl=en.
> > --
> > You received this message because you are subscribed to the Google Groups
> > "cherrypy-users" group.
> > To post to this group, send email to cherrypy-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cherrypy-users+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/cherrypy-users?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "cherrypy-users" group.
> To post to this group, send email to cherrypy-users@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cherrypy-users?hl=en.
> Yeah tools.staticdir works kinda weird... the little wrapper class makes it
> much nicer
> On Oct 29, 2012 10:24 AM, "Vincent Le Goff" <vincent.legoff....@gmail.com>
> wrote:
>> Hi,
>> I think I could serve static content without using the tools.staticdir
>> (as you did with your class, I guess). I will check that out.
>> Thanks,
>> Vincent
>> 2012/10/29, Walter Woods <woodswal...@gmail.com>:
>> > Hi Vincent,
>> > I'm not used to using a different dispatcher (the object-based one is
>> kind
>> > of awesome), but this is the class I always use for tools.staticdir,
>> maybe
>> > it will help:
>> > class StaticServer(object):
>> > """For testing - serves static files out of a given root.
>> > """
>> > def __init__(self, rootDir):
>> > self.rootDir = rootDir
>> > if not os.path.isabs(self.rootDir):
>> > self.rootDir = os.path.abspath(rootDir)
>> > On Mon, Oct 29, 2012 at 8:29 AM, Vincent Le Goff <
>> > vincent.legoff....@gmail.com> wrote:
>> >> Hi everyone,
>> >> I'm trying to get the tools.staticdir working, but it keeps on
>> >> failing.
>> >> I created a directory C:\static and a file test.txt inside it. I
>> >> would
>> >> like the directory content be served through the /static requests.
>> >> But when I send a request to:
>> >> myserver/static/test.txt
>> >> I get a 404 error.
>> >> As you can see, I'm not using the default dispatcher. Is it failing
>> >> because of that? Should I include some code in my own dispatcher
>> >> to call the hooks directly? I don't think so, but I don't know where
>> >> this problem comes from.
>> >> Thanks for your help,
>> >> Vincent
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "cherrypy-users" group.
>> >> To post to this group, send email to cherrypy-users@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> cherrypy-users+unsubscribe@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/cherrypy-users?hl=en.
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "cherrypy-users" group.
>> > To post to this group, send email to cherrypy-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > cherrypy-users+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/cherrypy-users?hl=en.
>> --
>> You received this message because you are subscribed to the Google Groups
>> "cherrypy-users" group.
>> To post to this group, send email to cherrypy-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> cherrypy-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/cherrypy-users?hl=en.
> --
> You received this message because you are subscribed to the Google Groups
> "cherrypy-users" group.
> To post to this group, send email to cherrypy-users@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cherrypy-users?hl=en.