Static directory has CSS and JS and image folders, which put some static files of the site, static in the site root directory, Configuring static files in Django This is a matter of the Internet, and yesterday, when adding new content, found a problem, My URL If there are multiple "/" words (my is more than 3 such as:/A/B/C/D), the template calls to the static file will not be able to get references to static files in templates:
<link rel= "stylesheet" type= "Text/css" href= ". /.. /static/easyui/easyui.css ">
in this way, the path of the calling static file becomes/a/static/easyui/easyui.css, causing the static files to be loaded incorrectly, I later wondered if it was possible to configure a new URL path at the time of the Django URL match, but it didn't seem to work. after a lot of other methods, but not all, and finally no way, can only take the most brutal solution, change the template's call to
<link rel= "stylesheet" type= "Text/css" href= ". /.. /.. /static/easyui/easyui.css ">
In this case the /A/B/C/D can be correctly displayed, but for the/a/b this path will have an impact? Because this is the same template implementation, it is not possible to write two identical templates for this reason, so try the following/a/b this path for
<rel= "stylesheet" type= "text/css" href= ". /.. /.. /static/easyui/easyui.css ">
This is also the right to display, Since this can also be displayed correctly, then I add a few more. /What,
<link rel= "stylesheet" type= "Text/css" href= ". /.. /.. /.. /.. /.. /.. /.. /.. /static/easyui/easyui.css ">
The result is that there is no problem. when matching to the corresponding file, the extra: /will be ignored. write This down in case you forget the same question later.
Django URL path vs. style relative path in template