I'm sure I'm overlooking something obvious here but I just can't get my
head around it.
Here's the setup: twisted.web server that generates dynamic content. Child
that serves up static content, e.g. css and favoicon. However, the static
content isn't making it. Instead, any hit to localhost/static actually
yields up a copy of / again.
Here's the server code
from twisted.internet import reactor, endpoints
from twisted.web import server
from twisted.web.resource import Resource
from twisted.web.static import File
content = """
<link rel="stylesheet" href="/static/test.css" type="text/css" />
<span class='twistedTest'>This</span> is a test
isLeaf = True
def render_GET(self, request):
return bytes(content, "utf-8")
if __name__ == "__main__":
root = tServer()
site = server.Site(root)
endpoint = endpoints.TCP4ServerEndpoint(reactor, 8080)
It's run with the command 'python tserver.py'. The expectation is that
what is inside the custom <span> will be red.
In the same dir as the script is a subdir 'static' with the css file inside
If I replace 'root' with root = Resource() then / doesn't serve up
anything, but /static is a directory listing of the static directory.
The dynamic server is basically a copy of several tutorials cooked down to
something that I could use to demonstrate the problem.
What am I missing here? /headscratch