How to serve css files in djangos's flatpages?

css, django, django-flatpages, django-templates, hyperlink

Solution

Use `"/static/base.css"` instead of `"static/base.css"`. The first one is a path relative to root `'/'`, while the second form is a path relative to the current page.

Problem

I'm building a basic site and thought of using the flatpages app for a couple of pages. Problem is, I'm not sure how to serve static files in my flatpages. The link in my flatpage template is this: ``` <link type="text/css" rel="stylesheet" href="static/base.css" /> ``` However, firebug shows that file is being looked at: ``` localhost:8000/example_flatpage/static/base.css ``` instead of ``` localhost:8000/static/base.css ``` Infact, every link in the template works this way. Instead of localhost:8000/home/ ``` localhost:8000/example_flatpage/home/ ``` Here's my default flatpage template: ``` <html><head> <title>title</title> <link type="image/x-icon" rel="icon" href="static/favicon.ico" /> <link type="text/css" rel="stylesheet" href="static/base.css" /> </head> <body> mainly plain text </body> </html> ``` Any ideas??

Original source