How to deploy Django asgi project to Heroku?

Viewed 349

When I try to deploy to Heroku the build succeeds but it fails to work.

In the Heroku logs --tail I get: Process exited with status 127 bash: daphne: command not found

I tried finding the Daphne install directory but couldn't.

My Procfile contains:

web: daphne chatapp.asgi:channel_layer --port $PORT --bind 0.0.0.0 -v2
chatworker: python manage.py runworker -v2


In my settings.py for the CHANNEL_LAYERS I have:
    CHANNEL_LAYERS = {
        "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": [os.environ.get('REDIS_URL', 6379)],
        },
    },
}

In my asgi.py file I have:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chatapp.settings")
django.setup()
application = get_default_application()
channel_layer = get_channel_layer()
0 Answers
Related