1

I have installed Django Channels. I am trying to run the following commands to run Daphne server and a worker.

> daphne chat.asgi:channel_layer --port $PORT --bind 0.0.0.0 -v2
> python manage.py runworker -v2

But each command opens up a live terminal showing logs. I just want to run them as background processes. Can anyone show me how to do this?

Utkarsh Sinha
  • 941
  • 2
  • 11
  • 30

3 Answers3

3

For these type of tasks, you should use supervisor.

Mohammad Mustaqeem
  • 1,034
  • 5
  • 9
3

At the moment nohup & is working alright for me. The following commands run the processes in the background.

> sudo nohup daphne MyProject.asgi:channel_layer --port 80 --bind 0.0.0.0 -v2 &
> sudo nohup python manage.py runworker -v2 &

kill -9 [pid] should help kill them when needed.

Utkarsh Sinha
  • 941
  • 2
  • 11
  • 30
0

You can use circus, supervisor or at least systemd.

Read this article to run easy and fast.

Mohammad Reza
  • 693
  • 9
  • 16