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 = datetime.datetime.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.
Related concepts
→
Django views
→
Semantic portal