[Twisted-web] using css with nevow

Michał Pasternak michal.dtz at gmail.com
Wed Oct 28 09:25:29 EDT 2009

Just add 'img' directory to rend.Page.children:


                children = { 'defaults.css' : static.File(.),







From: twisted-web-bounces at twistedmatrix.com
[mailto:twisted-web-bounces at twistedmatrix.com] On Behalf Of Eric Medina
Sent: Wednesday, October 28, 2009 8:46 AM
To: twisted-web at twistedmatrix.com
Subject: [Twisted-web] using css with nevow



I have been using twisted quite a bit these last 6 months for a networked
application i'm
working on. Recently, i've decided to port the web part of the app from
spyce to nevow.
However, i have encountered a problem with using css file. My css file has
references to
image files like below:

body {
    background: #EEE url(img/bg.gif);
    color: #444;
    font: normal 62.5% "Lucida Sans Unicode",sans-serif;
    margin: 0;

The following is a test file that loads an external xml file which
references a css file:

class TestPage(rend.Page):
    addSlash = True
    child_images = static.File('img')
    children = {'default.css': static.File('default.css')}
    docFactory = loaders.xmlfile('webtest.html')

site = appserver.NevowSite(TestPage())
reactor.listenTCP(8080, site)

The problem is that the images referenced inside the css file is not being
loaded when
the page is rendered. Can someone tell me how to fix this? This is the first
time i've used 
nevow or even twisted.web.

Thank you very much.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20091028/ac6f2650/attachment.htm 

More information about the Twisted-web mailing list