找不到ERROR 404 js文件

时间:2022-06-12 09:46:20

Html

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

settings.py

STATIC_URL = '/static/'

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

and upon loading it gives error

并在加载时给出错误

[HTTP/1.0 404 Not Found 16ms]

[HTTP / 1.0 404未找到16ms]

And project tree -

和项目树 -

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

How to solve this error.?

如何解决这个错误。

1 个解决方案

#1


1  

Based on your project directory layout it looks like you are missing bio from your path:

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

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

#1


1  

Based on your project directory layout it looks like you are missing bio from your path:

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

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