Home:ALL Converter>Django Channels Login Page

Django Channels Login Page

Ask Time:2022-01-11T16:32:32         Author:Karl Stulik

Json Formatter

I have a site that uses Django and Vue, hosted in Docker containers, along with other containers like Celery, Redis, Nginx, Postgress etc. I'd like to use Django Channels but cant seem to figure out how a login page is meant to work.

I'm not sure if I can do a whole website with Channels exclusively or must I use something like django.contrib.auth or Django REST framework together with Channels, I tried implamenting Django REST framework but got CORS errors.

According to the Channels Autentication Docs there are login and logout methods, but they sit in the receive() Channels consumer, what am I meant to do with the connect() method? Am I meant to accept the websocket connection before authenticating?

Or am I meant to use another meathod of authenticating my login page?

I just need a bit of guidance, your help would be much appreciated.

Author:Karl Stulik,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/70663765/django-channels-login-page
yy