Hi, 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) reactor.run()* 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. Regards, Eric
Just add 'img' directory to rend.Page.children: children = { 'defaults.css' : static.File(.), 'img': static.File('path_to_image_directory')} HTH, -- m From: twisted-web-bounces@twistedmatrix.com [mailto:twisted-web-bounces@twistedmatrix.com] On Behalf Of Eric Medina Sent: Wednesday, October 28, 2009 8:46 AM To: twisted-web@twistedmatrix.com Subject: [Twisted-web] using css with nevow Hi, 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) reactor.run() 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. Regards, Eric
OoO En ce doux début de matinée du mercredi 28 octobre 2009, vers 08:45, Eric Medina <eric.medina.atienza@gmail.com> disait :
body { background: #EEE url(img/bg.gif); color: #444; font: normal 62.5% "Lucida Sans Unicode",sans-serif; margin: 0; }
[...]
class TestPage(rend.Page): addSlash = True child_images = static.File('img') children = {'default.css': static.File('default.css')} docFactory = loaders.xmlfile('webtest.html')
In CSS, you should use url("images/bg.gif") because you define child_images (and not child_img). -- panic("esp_handle: current_SC == penguin within interrupt!"); 2.2.16 /usr/src/linux/drivers/scsi/esp.c
participants (3)
-
Eric Medina -
Michał Pasternak -
Vincent Bernat