edelvalle / reactor

Phoenix LiveView but for Django
630 stars 25 forks source link

/__reactor__ URL not found when no ASGI (dev) server is installed. Needs doc++ #50

Open nerdoc opened 1 year ago

nerdoc commented 1 year ago

Hi Eddy, I have not used reactor for a long time now (approx. v2 before), and much seems to have changed.

However; I can't setup a test project from your README.md - I use redis with proper RedisChannelLayer, redis is runing, but I always get the error message in the Django logs:

[28/Jun/2023 21:49:33] "GET /__reactor__ HTTP/1.1" 404 2222
Not Found: /__reactor__

And the browser dev console says:

Firefox can’t establish a connection to the server at ws://127.0.0.1:8000/__reactor__.

So this seems weird, as __reactor__ seems to be loaded as websocket pattern.

redis works, ASGI works. websocket_urlpatterns of reactor.urls is properly added to the ProtocolTypeRouter in asgi.py.

Any hints? Do I have a misconfiguration? Or are there some hints missing in the README.md?

nerdoc commented 1 year ago

Oh, as nearly always, found a solution in Layer 8. the asgi.py file is completely ignored if you use Django's builtin development server.

You have to install e.g. Daphne and place it into INSTALLED_APPS, then everything works as expected.

While this was my own fault, people who are not that fluent with ASGI should be given a hint in the README, that you need to use a server like daphne or uvicorn etc. to even develop a project using reactor.

Could you add that in the README? Maybe we'll keep this bug open until that? If you want I can try a PR too.