Django cheatsheet

Generate APP secret key

from django.core.management.utils import get_random_secret_key

get_random_secret_key()

Command line shortcut to stop all Django server processes.

ps -A | grep -i "python manage.py runserver" | awk '{print $1}' | xargs kill -9

Shortcut for zsh/bash

stop_django_server() {
ps -A | grep -i "python manage.py runserver" | awk '{print $1}' | xargs kill -9
}

To refresh your zsh - zsh -l