0

I'm building a PWA in Django. The serviceworker is located in

pwa->static->pwa->sw.js

Everthing gets loaded/cached and the serviceworker is running. If in manifest.json "start_url": "/" or "start_url": "/pwa" is set, i get this serviceworker not found error, from the manifest, so it's not installable, but if I set it to "start_url": "." i can install my App but then I get:

Directory indexes are not allowed here.
Request Method: GET
Request URL:    http://127.0.0.1:8000/static/pwa/ 

At app startup. How can i overwrite or redirect this request to http://127.0.0.1:8000/pwa/ ?

Strella
  • 340
  • 1
  • 9

1 Answers1

0

Django and service workers - serve "sw.js" at application's root url

The last entry solves my question.

Manifest, sw.js and index.html now in the template folder. The assets in static.

Linking in sw.js

var filesToCache = ["/pwa", "/static/pwa/vue.js",...
Strella
  • 340
  • 1
  • 9