当我运行react脚本“yarn start”时,我到index.html中的manifest.json的链接有效,但当我运行“python3 manage.py runserver”时则无效

Ash*_*shM 5 html json python-3.x django-staticfiles reactjs

当我运行“yarn start”时,我的index.html 文件中的manifest.json 链接工作正常,但是当我运行时,'python3 manage.py runserver'我在终端中得到的所有内容是:

Not Found: /manifest.json
"GET /manifest.json HTTP/1.1" 404 2234
Run Code Online (Sandbox Code Playgroud)

我的所有静态链接和导入也会发生这种情况。我对 Django 和 React 以及整个编程都很陌生,所以我认为我只是错过了一些简单的东西,但我无法弄清楚。

我一直在尝试使用,但即使我进行编辑以指向我的目录{% load static %},该链接也不起作用。我还尝试编辑and ,但我得到的只是终端中的语法错误。除此之外我一无所知。STATIC_URLsettings.pymanifest.jsonview.pyurls.py

前端/public/index.html

Not Found: /manifest.json
"GET /manifest.json HTTP/1.1" 404 2234
Run Code Online (Sandbox Code Playgroud)

前端/urls.py

<html>

    <head>

    <title>WebProject</title>


    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8">

    <link rel="manifest" href="manifest.json"/>

    </head>

    <body style="background-color: #FAF0E6; font-family: Verdana; font-size: 40px;">
    <div id="root"></div>

    </body>

</html>
Run Code Online (Sandbox Code Playgroud)

前端/views.py


from django.urls import path
from . import views
from django.conf.urls.static import static


urlpatterns = [
    path('', views.index),

]
Run Code Online (Sandbox Code Playgroud)

我希望我的浏览器能够正确加载 manifest.json 以及任何其他链接或导入,但我总是收到空白页面。

我在 Django 中使用 React,所以当我尝试导入index.js相同的“未找到”终端错误时,会弹出。我假设如果我解决了这个manifest.json问题,我也会解决其他导入和链接问题。

小智 3

我也遇到了同样的问题,发现Can't get rod of Missing manifest.json 错误
好吧,就我而言,它与浏览器缓存相关,切换到隐身模式就足够了。