15.8 Putting It All Together
When asked if Django allows for static webpages, people nod their head, say yes, and then tell others to use the flatpages app for that purpose. But we now know this is a bald-faced lie. The flatpages app, like everything in Django, relies on the MVC architecture provided by Django. The app provides a FlatPage model, which stores full webpages in the database, which are rendered in a template, thanks to a view, and pointed to by a URL pattern (or middleware).
The net effect is that, yes, Django provides the tools necessary to store a “static” webpage that a user can then request. However, the page is not truly static—it is being generated, which is desirable! If we change the navigation menu—as we did in this chapter—the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access