简体   繁体   中英

Django ASGI Deployment on Heroku

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

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM