[Tutor] Python, CGI and CSS

Eric Walstad eric at ericwalstad.com
Thu Apr 10 22:35:22 CEST 2008

Hi Alex,
On Thu, Apr 10, 2008 at 1:22 PM, Alex Krycek <agent.krycek at gmail.com> wrote:
> Hi,
> I've looked all over the internet but have not found an answer to my
> question. How do I apply an external stylesheet to the XHTML in a Python
> script? I tried to include the standard "<link rel='stylesheet'
> type='text/css' href='style1.css' />"" in with the rest of the printed
Try writing your html file by hand, tweaking the href and/or server
config and/or file permissions by hand until it *does* work.  Once you
have a working reference point, then make your Python script duplicate
what you know works.

> I
> tried other cgi scripts (still residing in the cgi-bin) and they did work.
View the HTML source of these working CGI scripts to see what the css
link tag looks like.  How does it differ from the css link tag output
of your Python script?

> I
> checked the error log, and this is what I'm getting: (2)No such file or
> directory.
Paste the actual log file line here.

> When I took both files out of my cgi-bin, as a test, the CSS rules were
> implemented. I'm not sure why it stops working when located in the cgi-bin
> folder.
It feels like a permissions problem or a configuration problem with
your web server.

What webserver are you using?
Have you followed any of the CGI tutorials?

More information about the Tutor mailing list