0

I want a clear cut explanation of how should I deploy Django 3.x and channels 2.x on Heroku. my asgi.py file

import os
import django
from channels.routing import get_default_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mainProj.settings')

django.setup()

application = get_default_application()

also,

import channels.asgi

and

channel_layer = channels.asgi.get_channel_layer()

returns an error saying no module named channels.asgi

kaizen
  • 53
  • 6

1 Answers1

1

do you want to get_channel_layer() from other views or function/methods?

should be import like this:

from channels.layers import get_channel_layer

channel_layer = get_channel_layer()
Sola
  • 1,512
  • 4
  • 15
  • 31