So I\'m building a Django progressive web app with offline support using service workers.
According to google\'s documentation, the sw.js file should be at the root
I was getting all the time the error DOMException: The script resource is behind a redirect, which is disallowed.
I spent hours trying to figure out the solution.
Apart from adding at urls.py:
from django.views.generic import TemplateView
urlpatterns = [
...,
url(r'^service-worker.js', (TemplateView.as_view(template_name="service-worker.js", content_type='application/javascript', )), name='service-worker.js'),
]
There was also another step needed. Instead of
I used: