About Stopping Any Django Development Web Servers

Create an alias in .zshrc or .bash_profile to stop Django development server at the default port:

alias stoprunserver="kill $(lsof -t -i:8000) 2>/dev/null || true"

Then you can execute it at any time:

$ stoprunserver

Tips and Tricks Dev Ops Django 6.x Django 5.2 Django 4.2 Bash Zsh