Stylesheet not respected

S

Suren

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?
 
I

Irmen de Jong

Suren said:
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
 
S

Suren

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...

Suren said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top