【发布时间】:2021-12-14 03:51:32
【问题描述】:
我在应用内的文件夹结构:
pwa->static->pwa->serviceworker.js
和
pwa->templates->indexPWA.html
如何在serviceworker.js 中引用indexPWA.html?
var filesToCache = ["indexPWA.html"] 不起作用,因为它不是正确的路径,但正确的路径是什么?
【问题讨论】:
-
你想在你的 JS 文件中做什么?
-
它是一个 serviceworker,所以它应该将 indexPWA.html 写入缓存。另一种解决方案是,如果我从 views.py 中获取 indexPWA.hmtl,但我不知道如何从渲染函数中获取 static/pwa/indexPWA.hmtl 处的模板
-
"../templates/indexPWA.html"
标签: python django django-staticfiles