Django views

Django views

Django views — is a Python function that takes a Web request and returns a Web response.

from django.http import HttpResponse
import datetime

def current_datetime(request):
    now =
    html = "<html><body>It is now %s.</body></html>" % now
    return HttpResponse(html)

itself contains whatever arbitrary logic is necessary to return that response.

Django views — Structure map

Clickable & Draggable!

Django views — Related pages: