[Twisted-web] Problems with images and css

Alberto Trujillo alberto.trujillo at ucd.ie
Thu Sep 8 03:04:42 MDT 2005

I don't know where is the exactly problem, only I know that is related 
with the path of the images I'll try to explain it better.
The template that I'm working with is a html template, which load 
different fragments. The template has 3 fragments (head, body and 
footer), so depende where the user click, I will load one fragment or 
another. In this way I can change the template of all my pages just 
changing one file.
The template (portal.html) is call by a nevow file (portal.py), that is 
the responsible of the calls to the others fragments.
In portal.htm I have this two lines to load the images and the css files

    child_styles = static.File('./templates/styles')
    child_images = static.File('./templates/images')

The fragment are place in different directories, I show a example:

    Main Directory:

        * portal.py
        * Fragments:
              o Fragment1:
                    + file.py
                    + file.html
                    + Images:
                          # image.jpg
                          # ...
                    + styles:
                          # ...
              o Fragment2:
                    + ...
        * templates:
              o portal.html
              o images:
                    + ...
              o styles:
                    + ....

Probably the example is not very good, but at least you have an idea 
about my structure directory.
As you can see the fragment can has their own images, and everything 
works well while I am running the application in my local machine, even 
without call the images directory like static file. But when I upload 
the application in the server, everything looks like nevow can't find 
the directories.
Should I insert a line   "child_styles = static.File('./styles')" and 
"child_images = static.File('./images')" in all my fragments, or should 
be the portal.py file who do this job.

I hope this information should be enough.

Thank you very much

Tommi Virtanen wrote:

>On Wed, 2005-09-07 at 17:15 +0100, Alberto Trujillo wrote:
>>I know that I must load the diretory where I have my images and css, 
>>because otherwise nevow is not going to render it.
>>Everything works well while this is running in my local machine, but in 
>>the server doesn't work. I have noticed that a simple '.' at the 
>>begining of a path, can destroy all my web, even the things that are not 
>>relate with that image.
>>Why is this happening?
>With the information you have given us, no one knows.
>First, simplify your system to the smallest possible,
>where the problem still occurs. Then, try to actually
>give us exact information on what you did, what happened,
>and what did you expect to happen.
>>Another problems is that even if I fix that problems, the website 
>>doesn't recover the information from my image directory or css 
>>directory, and I have to remove all the structure directory, upload 
>>again, close the web browser, etc.
>>Is nevow keeping information in any kind of cache, and that is probably 
>>the reason because even if I fix the problems, still I can't see anything?
>No, but your browser most likely is. Or a proxy is. It might even be a
>transparent proxy run by your ISP.
>Twisted-web mailing list
>Twisted-web at twistedmatrix.com

More information about the Twisted-web mailing list