I am facing an issue for mentioning one of the files in my django project for a .js file
One of the lines in main.js reads
navigator.serviceWorker.register("{% static '/static/sw.js' %}")
but while running the project it says Not Found: /sw.js
This is the directory structure -
How should I mention the sw.js file in my main.js file to avoid fileNotFound error?
Added to settings.py -
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
'/static/',
]
urls.py includes
urlpatterns = [
path('admin/', admin.site.urls),
path('', index),
path('/push_v1/', push_v1),
path('/subscription/', subscription),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Find the code on Github for reference Code Link

