[Fixed]-Django – How to use a static file in an other static file

1👍

Static files are static, which means they are not interpreted by Django, so cannot use tags in them.

However, you can refer to a static file from any other static file using relative paths assuming that the file is accessible.

There are a lot of topics on SO referring to how to include one javascript file from another one, for example: How do I include a JavaScript file in another JavaScript file?

0👍

Use a normal absolute/relative path to refer to files inside *.js files.

Static files are only served, not rendered by Django, therefore you can’t use template tags inside of them.

Leave a comment