我有一个 style.css 文件,它在我的 Django 项目中的所有应用程序中都很常见。它的位置如下:
testsite______
              |
              |
           testsite
              |
              |
             news 
              |
              |
            reviews
              |
              |
           templates------>static------>css------> style.css
              |
              |
           manage.py
在项目的 settings.py 中,我有STATICFILES_DIRS以下内容:
STATIC_URL = '/static/'
STATICFILES_DIRS = (
        "/path/to/my/project/templates/static/",
)
我在模板标题中调用 css 文件,如下所示:
<html>
    <head>
        <title>TEst site</title>
        <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/style.css"/>
    </head>
但是,css 不会加载。它给出了一个 404 错误,其中服务器在应用程序中查找 css 文件(新闻、评论)。错误如下:
"GET /test-site/css/style.css HTTP/1.1" 404 4147
我需要在 urls.py 中为 css 指定一些东西吗?我在这里错过了什么?