1
我試圖在我的現有wsgi實現旁邊使用asgi在Heroku上部署Django頻道。我可以使用以下設置將asgi和wsgi部署到heroku嗎?在Heroku上部署asgi和wsgi
我procfile:
web: gunicorn chatbot.wsgi --preload --log-file -
daphne: daphne chat.asgi:channel_layer --port $PORT --bind 0.0.0.0 -v2
chatworker: python manage.py runworker --settings=chat.settings -v2
我asgi.py文件:
import os
from channels.asgi import get_channel_layer
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chat.settings")
channel_layer = get_channel_layer()
我wsgi.py文件:
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chat.settings")
application = get_wsgi_application()
application = DjangoWhiteNoise(application)
我的溝道層在settings.py:
CHANNEL_LAYERS = {
'default': {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [os.environ.get('REDIS_URL', 'redis://localhost:6379')]
},
'ROUTING': 'chat.routing.channel_routing',
}
}
任何想法什麼'-v2'完成? –