Forums

Pythonanywhere css not loading. link href problem?

Hi

In my HTML I am trying to link to an external CSS file. All my many attempts look like the following

<head> <link rel="stylesheet" type = "text/css" href="mysite/assets/styles.css" /> </head>

In none of the variants, where I change the href value, can I get the CSS to load.

I have tried all kinds of variations on the href:

" styles.css" "/styles.css" "assets/styles.css" "mysite/assets/styles.css" etc. etc

and placed copies of styles.css in various directories

/home/crlong/mysite /home/crlong/mysite/assets /home/crlong/mysite/templates  <== this is location of the html page

and in all cases I get error messages like the following when I try to debug using the browser

HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). GET - http://cliverlong.pythonanywhere.com/styles.css or HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). GET - http://cliverlong.pythonanywhere.com/mysite/assets/styles.css etc. etc.

I have looked at various documentation on HTML link href on the web and in Pythonanywhere Forums and I can’t work out exactly how this links together – assuming my value of the href is the problem.

If this is documented somewhere clearly and I just can’t find it, please just point me at that description.

Much appreciated.

Clive

See http://help.pythonanywhere.com/pages/StaticFiles/ and http://help.pythonanywhere.com/pages/DebuggingStaticFiles/