import{_asa,casr,oast,ahasi}from"./chunks/framework.j4Nev8bF.js";constu=JSON.parse('{"title":"Servers and more","description":"","frontmatter":{},"headers":[],"relativePath":"rebel_coding/step5.md","filePath":"rebel_coding/step5.md"}'),o={name:"rebel_coding/step5.md"};functions(n,e,l,d,h,p){returnt(),r("div",null,[...e[0]||(e[0]=[i(`<h1 id="servers-and-more" tabindex="-1">Servers and more <a class="header-anchor" href="#servers-and-more" aria-label="Permalink to “Servers and more”"></a></h1><hr><p>We introduced Databases in Step 4; now we're going to take the scrapers we've built, and add them to an in-production Django server application!</p><h1 id="mvc-model-view-control" tabindex="-1">MVC - Model View Control <a class="header-anchor" href="#mvc-model-view-control" aria-label="Permalink to “MVC - Model View Control”"></a></h1><hr><p><a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" target="_blank" rel="noreferrer">MVC</a> is a way to divide the components of a full-stack website into smaller parts; more technically known as a <em>software design pattern</em>.</p><p><strong>Models</strong> define the data that forms the software's content. Blog posts, images, etc; anything and everything that sits in a database is defined by the models.</p><p><strong>Views</strong> control the presentation of software's content; when a web-page is visited, views determine how the content is presented.</p><p><strong>Controllers</strong> do the heavy lifting between models and views, by retrieving the data and responsing to user input.</p><h3 id="how-does-django-differ" tabindex="-1">How does Django differ? <a class="header-anchor" href="#how-does-django-differ" aria-label="Permalink to “How does Django differ?”"></a></h3><p>The server system that we focus on in Rebel Coding is Django with puts a bit of a twist on the ol' MVC model; namely by switching out Views for Templates and referring to Controllers and Views ...</p><p>If it sounds confusing, you won't be the first to be befuddled; and it is easily comprehended once you start working with the toolset.</p><p>As a matter of fact, we don't even bother with the Template part in the remainder of this course, as we pass that task off to a JavaScript client instead.</p><h1 id="why-django" tabindex="-1">Why Django? <a class="header-anchor" href="#why-django" aria-label="Permalink to “Why Django?”"></a></h1><hr><p>Because Django pre-packages as administrative interface, pure, plain and simple.</p><h3 id="models-py" tabindex="-1">Models.py <a class="header-anchor" href="#models-py" aria-label="Permalink to “Models.py”"></a></h3><pre><code>class Post(models.Model):