The relative position of the registration snippet within the website matters! A register.js in /static/js/ will register a service-worker in this sub-path/scope,
meaning the service worker won’t be doing anything when navigating to for example /something/ or the web root. For now, place register.js in the web root (so it will be available at /register.js).
It’s also important to note, that service workers require HTTPS, even in a test setup, the browser won’t accept any service worker not served via a secure connection. If you don’t have an HTTPS capable web-server, here is a quick tutorial on how to set up one.