[Tutor] Python, CGI and CSS

Alex Krycek agent.krycek at gmail.com
Thu Apr 10 22:43:03 CEST 2008


Eric,

I'm sorry, I never actually managed to get any stylesheets to work with my
cgi scripts. The scripts that did work are just simple HTML. I'm using
Apache 2.2.8 on a Mac OS X 10.4.11 system. When I get home I'll definitely
look up the log file and paste it here. I'll also have to fool around with
the permissions and httpd.conf file.

I did look into CGI tutorials, but they didn't use Python code. They used
something like:
start_html(-title => $title,
-head => style({type => 'text/css'} )

Thanks for the suggestions though.



On 4/10/08, Eric Walstad <eric at ericwalstad.com> wrote:
>
> 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
> > XHTML.
>
> 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080410/ab9f78f4/attachment.htm 


More information about the Tutor mailing list