I seem to have a problem processing css files with twisted.web using twisted templates.<br><br><br>I get a message in my Firefox error console saying that it could not load the css file since the type was text/html not text/css<br>

<br>I am running on windows 7 32bit<br>python 2.7.3<br>twisted 12.2.0<br>twisted templates<br><br>The template renders fine but without the styling.<br><br>I
 have hunted around for some ideas as to what the problem is but most 
seem to be that people have not added the static file location to root.<br>
<br>In theory I do not have that problem since the message says it has 
found the file but will not process it since it has the wrong type.<br><br>In
 my template file I add the link for the css file and give it the 
correct file type. But I assume I have overlooked something since it 
refuses to process the css.<br>
<br>My template is based on one of the demo templates and I have really just added the css link<br><br>&lt;html xmlns:t=&quot;<a href="http://twistedmatrix.com/ns/twisted.web.template/0.1" target="_blank">http://twistedmatrix.com/ns/twisted.web.template/0.1</a>&quot;&gt;<br>

&lt;head&gt;<br>&lt;title&gt;<br>Add Admin User<br>&lt;/title&gt;<br>&lt;link href=&quot;styles/jahstyle.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div t:render=&quot;header&quot; /&gt;<br>

&lt;ul&gt;<br>&lt;li t:render=&quot;widgets&quot;&gt;<br>&lt;t:slot name=&quot;widgetName&quot;/&gt;<br>&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;div t:render=&quot;footer&quot; /&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><br><br>

The python that is processing this file is based on the samples I found with some additions to add the staic file for  the css<br><br><br>from twisted.web.server import Site, NOT_DONE_YET<br>from twisted.web.resource import Resource<br>

from twisted.internet import reactor<br>from twisted.web import server, static<br><br>from twisted.web.template import Element, renderer, XMLFile, flattenString<br>from twisted.python.filepath import FilePath<br><br>class WidgetsElement(Element):<br>

    loader = XMLFile(FilePath(&#39;iteration-1.xml&#39;))<br><br>    widgetData = [&#39;gadget&#39;, &#39;contraption&#39;, &#39;gizmo&#39;, &#39;doohickey&#39;]<br><br>    @renderer<br>    def widgets(self, request, tag):<br>

        for widget in self.widgetData:<br>            yield tag.clone().fillSlots(widgetName=widget)<br><br>    @renderer<br>    def header(self, request, tag):<br>        return tag(&#39;Header.&#39;)<br><br>    @renderer<br>

    def footer(self, request, tag):<br>        return tag(&#39;Footer.&#39;)<br><br><br>def printResult(result):<br>    print result<br><br>class Root(Resource):<br>    isLeaf = True<br>    def render_GET(self, request):<br>

        request.write(&quot;&lt;!DOCTYPE html&gt;\n&quot;)<br>        #flattenString(request, Hello()).addCallback(request.write)<br>        flattenString(None, WidgetsElement()).addCallback(request.write)<br>        request.finish()<br>

        return NOT_DONE_YET<br><br>root = Root()<br>root.putChild(&#39;styles&#39;, static.File(&quot;styles&quot;))<br>site = Site(root)<br>reactor.listenTCP(8080, site)<br>reactor.run()<br><br>So if anyone has some clues as to what I should look for next that would be very welcome.<br>

<br>Regards<br><br>John Aherne<br clear="all"><div><br></div>-- <br><b>John Aherne</b><div><b><br></b><div><b><img src="http://www.rocs.co.uk/Images/rocs_logo_sig.gif"><br></b></div><div><b><br></b></div><div><div><b><a href="http://www.rocs.co.uk" target="_blank">www.rocs.co.uk</a><br>
</b></div></div></div><div>020 7223 7567</div><br>