Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django静态根404错误_Python_Django_Static_Django Staticfiles - Fatal编程技术网

Python Django静态根404错误

Python Django静态根404错误,python,django,static,django-staticfiles,Python,Django,Static,Django Staticfiles,现在,我正在尝试将django项目html文件连接到静态文件,但不断出现404错误。我的项目组织为 src admin homePage media static homepage css images fonts js templates 在我的设置文件中,我有 STATIC_URL = "/static/" STATIC_ROOT = os.pa

现在,我正在尝试将django项目html文件连接到静态文件,但不断出现404错误。我的项目组织为

src
    admin
    homePage
    media
    static 
       homepage
           css
           images
           fonts
           js
    templates
在我的设置文件中,我有

STATIC_URL = "/static/"

STATIC_ROOT = os.path.join(BASE_DIR, "static")

STATICFILES_DIRS = (
        os.path.join(BASE_DIR, 'myProjectName/static'),
)
在我的html文件中

{% static "home/css/bootstrap.css"%}

为什么我总是收到404个错误?谢谢您的时间。

在设置文件中打开Debug=True,错误页面将帮助您找出问题所在

您是否在模板中包含了
{%load staticfiles%}
?您的文件路径中也存在差异-您的文件路径状态为
主页
,但您的文件结构中有一个名为
主页
的文件夹,我从未包含此文件夹。我应该把{%load staticfiles%}放在我的html文件的什么地方?你通常把它和任何
{%extends“base.html”%}
语句放在顶部