0

I'm relatively new to ASGI and Django Channels, so this is probably a very basic question.

I got ASGI running thanks to Django Channels in one of my Django projects and it works fine. I then want to work on my old project, which doesn't yet use ASGI. I kill the debug server running locally on 127.0.0.1, switch environments (in an entirely new shell window) and start the debug server running for the old project:

(server) me@laptop server % ./manage.py runserver

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
June 12, 2021 - 11:23:40
Django version 3.2, using settings 'oldproj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /ws/chats/1056/
[12/Jun/2021 11:23:46] "GET /ws/chats/1056/ HTTP/1.1" 404 6103
[12/Jun/2021 11:23:46,327] - Broken pipe from ('127.0.0.1', 58901)

Not Found: /ws/chats/1056/
[12/Jun/2021 11:37:43] "GET /ws/chats/1056/ HTTP/1.1" 404 6103
[12/Jun/2021 11:37:43,293] - Broken pipe from ('127.0.0.1', 59096)

Not Found: /ws/chats/1056/
[12/Jun/2021 11:37:43] "GET /ws/chats/1056/ HTTP/1.1" 404 6103
[12/Jun/2021 11:37:43,293] - Broken pipe from ('127.0.0.1', 59096)

These error messages repeat every 30 seconds or so. I suspect there's a process still running in support of the new, ASGI-equipped project but I don't know what it is. (I looked for daphne, nginx, and others.)

What do I need to do to properly shut down my new Django Channels project so these errors don't show up when running the server in the old one?

Dylan
  • 2,315
  • 2
  • 20
  • 33
  • Is there a browser window running that's trying to connect via websockets to the other project? – Kedar Jun 12 '21 at 18:57
  • 1
    @Kedar, that's brilliant! I didn't think so, but I forgot that I had a completely different browser still running. If you write this up as the solution, I'll accept it gratefully. – Dylan Jun 12 '21 at 22:08

1 Answers1

1

You probably have a browser window running that is attempting websocket connections.

Since both projects share the endpoint (http://localhost:8000 or something similar), your other, unrelated projects is receiving these requests and returning a 404.

Kedar
  • 1,648
  • 10
  • 20