Search code examples
djangochanneldaphne

Daphne server command not available


I have created a django app using channels, and tested it with python3 manage.py runserver, which, as I understand, runs a Daphne server as part of the command. Now I just want to deploy the app by running a standalone Daphne server with some workers, etc. following the documentation. Problem is, I don't seem to have the daphne command available to me in the terminal. Running daphne my_project.asgi:channel_layer just results in my terminal telling me the daphne command isn't found. (Running Ubuntu 17.10, if it's at all relevant)

Daphne was definitely installed when I installed the channels package using pip. When I run pip3 install daphne it says that I have all the relevant packages and the installation is up-to-date. Am I doing something stupid here? Seems like this just works for everyone else. How can I get the daphne command available to me so I can start a server with it?


Solution

  • Got it. The fix was really easy; at first, I couldn't find the daphne install directory, but it was in ~/.local/bin. You can either run daphne from that directory, or add the directory to the system PATH so that bash can run it directly.