104π
The answer is findable via Google β and answered in other forums. Example solution is available on the Unix & Linux StackExchange site.
To be explicit, you could do:
ps auxw | grep runserver
This will return the process and its respective PID, such as:
de 7956 1.8 0.6 540204 55212 ? Sl 13:27 0:09 /home/de/Development/sampleproject/bin/python ./manage.py runserver
In this particular case, the PID is 7956
. Now just run this to stop it:
kill 7956
And to be clear / address some of the comments, you have to do it this way because youβre running the development server in the background (the &
in your command). Thatβs why there is no βbuilt-inβ Django stop optionβ¦
- [Django]-How can I avoid "Using selector: EpollSelector" log message in Django?
- [Django]-How to change a django QueryDict to Python Dict?
- [Django]-How can I get MINIO access and secret key?
- [Django]-Saving ModelForm error(User_Message could not be created because the data didn't validate)
- [Django]-Check if OneToOneField is None in Django
- [Django]-Django ModelForm to have a hidden input
- [Django]-Django 1.5 β How to use variables inside static tag
- [Django]-Django Celery Logging Best Practice
- [Django]-Fields.E304 Reverse accessor clashes in Django
6π
well it seems that itβs a bug that django hadnβt provided a command to stop the development server . I thought it have one before~~~~~
- [Django]-Django Reverse Accessor Clashes
- [Django]-Backwards migration with Django South
- [Django]-Django Queryset with filtering on reverse foreign key
5π
We can use the following command.
-> netstat -ntlp
then we will get number of process running with PID, find our python server PID and Kill process.
-> kill -9 PID
- [Django]-Django REST framework post array of objects
- [Django]-Authenticate by IP address in Django
- [Django]-Django's timezone.now does not show the right time
3π
As far as i know ctrl+c or kill process is only ways to do that on remote machine.
If you will use Gunicorn server or somethink similar you will be able to do that using Supervisor.
- [Django]-How to show processing animation / spinner during ajax request?
- [Django]-What is the difference between null=True and blank=True in Django?
- [Django]-Only accept a certain file type in FileField, server-side
2π
This worked for me on windows.
Use the below command to list all connections and listening ports (-a) along with their PID (-o).
netstat -a -o
Then use this to kill the process
taskkill /PID PUT_THE_PID_HERE /F
- [Django]-Create a field whose value is a calculation of other fields' values
- [Django]-How to pull a random record using Django's ORM?
- [Django]-In Django Admin how do I disable the Delete link
1π
From task manager you can end the python tasks that are running.
Now run python manage.py runserver
from your project directory and it will work.
- [Django]-Django Rest framework, how to include '__all__' fields and a related field in ModelSerializer ?
- [Django]-Why does DEBUG=False setting make my django Static Files Access fail?
- [Django]-How to set True as default value for BooleanField on Django?
1π
Programmatically using a .bat
script in Command Prompt
in Windows:
@ECHO OFF
SET /A port=8000
FOR /F "tokens=5" %%T IN ('netstat -ano ^| findstr :%port%') DO (
SET /A processid=%%T
TASKKILL /PID %%T /F
)
gives
SUCCESS: The process with PID 5104 has been terminated.
- [Django]-Django: How do I add arbitrary html attributes to input fields on a form?
- [Django]-Django: How to build a custom form widget?
- [Django]-How to squash recent Django migrations?
- [Django]-Effects of changing Django's SECRET_KEY
- [Django]-What is choice_set in this Django app tutorial?
- [Django]-Target WSGI script cannot be loaded as Python module