Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Dev. Server Refuses to Quit

The development server for Django is acting very odd. The browser accessing it gets stuck on loading, and any attempt to quit it does not work. When I hit control c it seems to quite, but in actuality is still running. The only way to make it quit is to restart my computer, which is very frustrating. Is there any way to force it to quit. I'm on a mac running mountain lion. Does anyone know the name of the processe it runs is called so I can force it to quit from activity monitor.

like image 356
sinθ Avatar asked Dec 27 '12 21:12

sinθ


People also ask

How do I stop a Django server from running?

Though the message in the console states that Ctrl+Break should be used to quit the server, it is not possible; one can only use Ctrl+F4 works to close the console.

How do I quit a development server?

You can Quit the server by hitting CTRL-BREAK.

Why my Django server is not working?

The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.


2 Answers

Assuming the command you are using to run django is:

python manage.py runserver

You can kill it with:

pkill -f 'python manage.py runserver'

This is much better than killall python as other programs might be using python, and that would kill them all.

like image 182
gozzilli Avatar answered Sep 19 '22 11:09

gozzilli


Django runs in the Python process (sometimes there are more than 1), you could use

killall python

or, from the activity monitor, just kill anything with Python in it. At the end of the day though, the manage.py runserver command only creates a new (sequentially numbered, usually) Python process. The only time stopping all python processes might be a problem is if your running more than 1 python service from your computer, in which case you might want to edit django-admin.py and look at having it create a named process.

like image 42
Titus P Avatar answered Sep 19 '22 11:09

Titus P