错误 404 找不到 js 文件

ERROR 404 js file not found

本文关键字:文件 js 找不到 错误      更新时间:2023-09-26

>Html

{% load staticfiles %}
<html>
    <head>
        <script src="{% static "js/fillform.js" %}" type="text/javascript">
        </script>
    </head>
    <body>
        yo man ssup
        <button type="button" id="button">
            click
        </button>
    </body>
</html>

settings.py

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

加载时出现错误

[HTTP/1.0 404 未找到 16ms]

和项目树 -

bio
-- static
    |-- bio
        |-- js
            |-- template
-- template
    |--bio
        |-- index.html

如何解决此错误。?

根据您的项目目录布局,您的路径中似乎缺少bio

{% static "bio/js/fillform.js" %}