Show Menu
Cheatography

web python and django Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

console

source myvenv­/bi­n/a­ctivate
turns the venv on
python manage.py runserver
starts a server

migrations

python manage.py migrate
python manage.py makemigrations ask
 

page render

def index(request):
    latest_question_list = Question.objects.order_by('-pub_date')[:5]
    context = {'latest_question_list': latest_question_list}
    return render(request, 'ask/index.html', context)