相关疑难解决方法(0)

什么是create-react-app中的public/manifest.json文件?

我知道manifest.json用于chrome扩展,但在这里它是其他东西.它的文件代码:

{
  "short_name": "React App",
  "name": "Create React App Sample",
  "icons": [
    {
      "src": "favicon.ico",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "start_url": "./index.html",
  "display": "standalone",
  "theme_color": "#000000",
  "background_color": "#ffffff"
}
Run Code Online (Sandbox Code Playgroud)

当我更改某个值,页面更新,但没有任何变化.

reactjs create-react-app

54
推荐指数
2
解决办法
3万
查看次数

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

当我运行“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 …
Run Code Online (Sandbox Code Playgroud)

html json python-3.x django-staticfiles reactjs

5
推荐指数
1
解决办法
4654
查看次数