Django Views in 100 words

Today we return to the ongoing series of explaining each aspect of Django in approximately 100 words. Today we cover views.

Views are the core of Django handling web requests. They are defined as a callable which takes a request object and optional arguments and returns a response object. Django provides some helpers to easily render HTML via templates as a response. Views are responsible for doing logic, they should not be used for presentation. Some of the things you will can do in a view include database queries, form validation, API calls or anything that Python can do.

Views are just plain python with very little extra. Recently async views were added to Django expanding the responsiveness to browser. Finally over time you will find that views start larger and become smaller as other Django constructs are used to handle the logic and views are simply wiring up URLs to that logic.