---
source: https://iinventedlight.com/library/notes/django-request-response.md
title: "Django views receive HttpRequest and return HttpResponse"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (django/django); prose restates cited source lines in own words"
license_family: django-bsd3
attribution: "Summary by iinventedlight (AI-assisted). Sources: Django docs, Request and response objects, BSD-3-Clause (django/django); Django source, django.http.request.HttpRequest, BSD-3-Clause (django/django). Notices: Django documentation and source (django/django): Copyright (c) Django Software Foundation and individual contributors; BSD-3-Clause (https://raw.githubusercontent.com/django/django/stable/6.1.x/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-10
status: published
approved_by: "Cole Withington, 2026-11-10 10:08 PT, Librarian chat widget t33s2: \"Yes, publish all 25 Django and Vue drafts\""
checked_on: 2026-11-10
as_of: 2026-11-10
confidence: medium
untested: "No Django project was run for this note; only the fetched documentation and source files were read."
category: coding-references
topic_area: "code-backend: Django request response"
tags: [django, httprequest, httpresponse, http]
client: Librarian
sources:
  - id: S1
    title: "Request and response objects"
    publisher: Django docs
    url: https://docs.djangoproject.com/en/6.1/ref/request-response/
    accessed: 2026-11-10
    license: "BSD-3-Clause"
  - id: S2
    title: "django.http.request.HttpRequest"
    publisher: Django source
    url: https://github.com/django/django/blob/stable/6.1.x/django/http/request.py
    accessed: 2026-11-10
    license: "BSD-3-Clause"
---
# Django views receive HttpRequest and return HttpResponse

**Answer:** Django moves state with request and response objects. On each page fetch it builds an `HttpRequest` with request metadata, loads the matching view, and passes that `HttpRequest` as the first argument. The view must return an `HttpResponse`.

## HttpRequest

`django.http.request.HttpRequest` is a basic HTTP request object. Attributes such as `scheme`, `path`, and `body` are documented as read-only unless stated otherwise. It can return the HTTP host using the environment or request headers. A method reports whether the client accepts a response in the given media type.

These APIs live in the `django.http` module.

## See also

- [django-views](https://iinventedlight.com/library/notes/django-views/)
- [django-middleware](https://iinventedlight.com/library/notes/django-middleware/)

## Claims

- id: C1
  claim: Django passes state through the system with request and response objects.
  source: S1
  evidence: "Django uses request and response objects to pass state through the system."

- id: C2
  claim: Each view must return an HttpResponse.
  source: S1
  evidence: "Each view is responsible for returning an HttpResponse object."

- id: C3
  claim: HttpRequest is a basic HTTP request object.
  source: S2
  evidence: "A basic HTTP request."

- id: C4
  claim: HttpRequest can return the HTTP host from the environment or headers.
  source: S2
  evidence: "Return the HTTP host using the environment or request headers."

## Sources

- [S1] Request and response objects. Django docs. https://docs.djangoproject.com/en/6.1/ref/request-response/ . License: BSD-3-Clause. Accessed 2026-11-10.

- [S2] django.http.request.HttpRequest. Django source. https://github.com/django/django/blob/stable/6.1.x/django/http/request.py . License: BSD-3-Clause. Accessed 2026-11-10.


License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Django documentation and source (django/django): Copyright (c) Django Software Foundation and individual contributors; BSD-3-Clause (https://raw.githubusercontent.com/django/django/stable/6.1.x/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
