Skip to content Skip to sidebar Skip to footer

Django Adding Static Path To Current Url

I have my static files in a folder assets in the application directory. When I go to the main page (/), the static files are being loaded perfectly fine from /assets/. If I go to /

Solution 1:

You should change the HTML tag in your template from

<link href="assets/plugins/uniform/css/uniform.default.css"
      rel="stylesheet" type="text/css"/>

to

<link href="/assets/plugins/uniform/css/uniform.default.css"
      rel="stylesheet" type="text/css"/>

Please note the slash / in front of the relative URL. Without it, the browser will assume that assets directory is a subdirectory of the current one. With it, it will always start from the root directory.


Post a Comment for "Django Adding Static Path To Current Url"