django / daphne

Django Channels HTTP/WebSocket server
BSD 3-Clause "New" or "Revised" License
2.32k stars 256 forks source link

Added runserver to Daphne. #429

Closed carltongibson closed 1 year ago

carltongibson commented 1 year ago

Refs #428.

carltongibson commented 1 year ago

Hey @kezabelle — no urgency, but wondering if you'd be interested by 79abfaeb2047cc7972017fe8165411d8e49a6f9d... 🤔 — it's a question of what's the minimum to bootstrap the app registry here?, preferably without going all the way to pytest-django etc. That seems to me your kind of ballpark. 😜

(Hope you're doing well!)

carltongibson commented 1 year ago

Hey @massover — I've moved the runserver command from Channels here.

With a...

INSTALLED_APPS = [
    "daphne",
    ...
]

... it all seems to be working.

I don't know if you've got a cycle to glance over for any gains? (No problem if not 🎁)

I looked over your standalone implementation but didn't want to add the run_wsgi like options here (at this stage). The final version, living in Django, eventually, one day, maybe 😜, will need to handle both protocols.

carltongibson commented 1 year ago

OK, I'm going to merge this as is, so that I can continue working. We can follow up with adjustments later if needed.

gnat commented 1 year ago

Nice one!! @carltongibson Tested, seems to work just fine with the psycopg3 PR as well! https://github.com/django/django/pull/15687

For those following along:

  1. python3 -m pip install git+https://github.com/django/daphne.git@7453ad9
  2. In settings.py
    INSTALLED_APPS = [
    "daphne",
    #...
    ]
    #WSGI_APPLICATION = 'crdbtest.wsgi.application'
    ASGI_APPLICATION = 'crdbtest.asgi.application'
  3. python3 ./manage.py runserver
carltongibson commented 1 year ago

@gnat Thanks for testing! (More helpful than you think 🙂)