Chapter 6. Single-Page Web Application

Designing enriching experiences for the Web is something that we, as developers, consistently strive for. In recent years we have grown accustomed to combining different languages and frameworks, which usually requires better communication between the client-side and backend infrastructures.

With the recent shift in focus to client-side-heavy development, we’re likely to pay even greater attention to the organization and structure of how we lay out the architecture of our projects. In this chapter, we’ll create a simple single-page web application and step through how the Django framework fits into this new shift in development.

What Are Single-Page Web Applications?

Single-page web applications—SPAs—are a big part of this shift to client-side development. There are a few misconceptions as to what they are and how they should be used. Some developers believe that this category of applications includes only those that just need a single page, such as a to-do application. It’s a reasonable assumption, but that is not entirely what the term “single page” means with these types of applications.

The “single page” part of an SPA refers to the fact that the server sends the client all of the presentation logic needed to a single page. From this starting point, the browser manipulates the data to create pages asynchronously and on an “as needed” basis. After this initial page load, the server interacts with the client over the API, sending only data on ...

Get Lightweight Django now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.