Hi Justin, I'm going to reply to you on the ticket you opened at https://github.com/django/channels/issues/1075 with the same question :)
Andrew On Fri, Jun 8, 2018 at 7:56 AM Justin Lee <justintt1...@gmail.com> wrote: > I was just trying to integrate channels into an existing django/DRF > project and I have been running into an issue where my original urls paths > are breaking when I do runserver. My root index view leads to 301 infinite > redirects loop and my other app views results in a 404. The Socket server > is definitely up as I have tried to do the following in console. It is just > the http views + routes that are somehow breaking > > > > var chatSocket = new WebSocket('ws://' + window.location.host + '/'); > > chatSocket.onmessage = function(e) { > > var data = JSON.parse(e.data); > > var message = data['message']; > > console.log(message) > > } > > chatSocket.send(JSON.stringify({'message': "Hello World"})); > > > OUTPUT: > > VM862:4 Hello World > > > > The app works when I remove "channels" from installed_apps > > It also works if I try to run the asgi app through daphne directly > > I just want the app to work in django dev runserver > > > I am using django auth backend with login_required for all my views. > > I am fairly new to django and would love some help on this! > > my_app/urls.py > > urlpatterns = [ > path('users/', include('django.contrib.auth.urls')), > path('admin/', admin.site.urls), > path('api/', include('api.urls', namespace='api')), > url(r'^.*', index, name='index'), > ] > > my_app/routing.py > > from channels.auth import AuthMiddlewareStackfrom channels.routing import > ProtocolTypeRouter, URLRouterfrom django.urls import path > from api.consumer import EchoConsumer > > application = ProtocolTypeRouter({ > 'websocket': AuthMiddlewareStack( > URLRouter([ > path('', EchoConsumer) > ]) > ) > }) > > Settings > > # Application definitionINSTALLED_APPS = [ > 'channels', > 'django.contrib.admin', > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.messages', > 'django.contrib.staticfiles', > 'django.contrib.postgres', > 'django_extensions', > 'rest_framework', > 'rfs.apps.RfsConfig', > 'api.apps.ApiConfig', > 'import_export', > ] > MIDDLEWARE = [ > 'django.middleware.security.SecurityMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.common.CommonMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ] > > Versions > > channels==2.1.1 > daphne==2.1.2 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/de5f781b-ecca-4c7c-a1f5-3b01fff26531%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/de5f781b-ecca-4c7c-a1f5-3b01fff26531%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1ur96tzjwFaw%3D_E-NaQoAPH0%2BKamc2QzL2-%2BG50A2hNOXQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.