468,136 Members | 1,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,136 developers. It's quick & easy.

Stylesheet not respected

I was able to the see weird stylesheet behavior on opera, IE and
mozilla under
mod_python. Here is some python code that exhibited the behavior. I
have the body.css in the same folder as this file and the background is

set to blue. When I access it at http://localhost/test.py, the html
page shows Hello World with no blue background.

If i view source, copy into test.html, launch it in browser, everything

is good. Does the lack of .html extension in the address bar cause
trouble?

from mod_python import apache
def handler(req):
req.content_type = 'text/html'
req.write("""
<html>
<head>
<title>Hello World</title>
<link href="body.css" type="text/css" rel="stylesheet"
/>
</head>
<body>
Hello World
</body>
</html>""")

If I inline the style, it works fine. Any ideas why this happens?

Oct 24 '06 #1
2 1018
Suren wrote:
I was able to the see weird stylesheet behavior on opera, IE and
mozilla under
mod_python.
[snip]

I'm 99% sure this has nothing to do with Python but is just an error
in your CSS file. Show the CSS so we might be able to see the problem.

One thing to check for though is that your web server is serving CSS
files with the correct content type (text/css and not text/plain or
somthing equally silly).

--Irmen
Oct 24 '06 #2
It was nothing related to python but how my httpd.conf was setup.

My apache conf was set to handle files under this.

<Directory "C:/Program Files/Apache Group/Apache2/htdocs/test">

When I said href="body.css", it was looking under test\body.css. My
project src was way deeper and I was assuming that it would like for
the css file where the python source is.

I am sure this is a newbie gotcha...
Irmen de Jong wrote:
Suren wrote:
I was able to the see weird stylesheet behavior on opera, IE and
mozilla under
mod_python.
[snip]

I'm 99% sure this has nothing to do with Python but is just an error
in your CSS file. Show the CSS so we might be able to see the problem.

One thing to check for though is that your web server is serving CSS
files with the correct content type (text/css and not text/plain or
somthing equally silly).

--Irmen
Oct 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Sarah Haskins | last post: by
5 posts views Thread by David Trimboli | last post: by
7 posts views Thread by pintihar | last post: by
3 posts views Thread by =?iso-8859-1?Q?Daniel_Lidstr=F6m?= | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.