Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: Make the server continue to run without using runserver

I have started using django_channels on my server. But if I want the websocket to work, I have to use:

python manage.py runserver 0.0.0.0:8080

And the server runs and I can connect ws://myip:8080

But, as soon as I do ctrl+c. It quits i.e, I am unable to connect on ws://myip:8080 anymore.

I want to be running continuously.

like image 597
Streetway Fun Avatar asked Jun 02 '26 06:06

Streetway Fun


1 Answers

You can keep it running in background without hanging up. Just use below command.

nohup python manage.py runserver 0.0.0.0:8080 &

To kill

Find pid running on port 8080

netstat -nlp | grep :8080

and then after you get pid

kill pidnumber
like image 54
Astik Anand Avatar answered Jun 05 '26 02:06

Astik Anand