<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Animesh Kumar on Medium]]></title>
        <description><![CDATA[Stories by Animesh Kumar on Medium]]></description>
        <link>https://medium.com/@akanimesh?source=rss-97b1901cd4fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mQVByaI-LOY2vneM</url>
            <title>Stories by Animesh Kumar on Medium</title>
            <link>https://medium.com/@akanimesh?source=rss-97b1901cd4fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:41:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akanimesh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A story based guide to how Django works]]></title>
            <link>https://medium.com/@akanimesh/a-story-based-guide-to-how-django-works-3b6e1646aa56?source=rss-97b1901cd4fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b6e1646aa56</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[mvt]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python-web-developer]]></category>
            <dc:creator><![CDATA[Animesh Kumar]]></dc:creator>
            <pubDate>Sun, 08 Aug 2021 21:00:05 GMT</pubDate>
            <atom:updated>2021-08-09T04:13:07.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*hMzxkuciTPIh4reOqKXtJQ.gif" /></figure><p>So, you got to know about the Django from somewhere and now you wanna say “Hi” to it. Well in this blog, I am trying to give you a very beginner friendly introduction about the Django and it’s working process using a very interactive, story based format. So let’s start our very first move with a question.</p><h4><strong>What is Django</strong></h4><p>Once upon a time some developers were writing codes to build applications and they got frustrated with the number of lines of codes that they had to write again and again. Irony is that they were writing codes in <strong>PYTHON</strong> not in <strong>C</strong> (It proves that the rich people too have problems in their lives). So those lazy, frustrated programmers decided to make a Framework to solve this problem. Those developers were<a href="https://en.wikipedia.org/wiki/Adrian_Holovaty"> Adrian Holovaty</a> and<a href="https://en.wikipedia.org/wiki/Simon_Willison"> Simon Willison</a>, <a href="https://en.wikipedia.org/wiki/Web_programmer">web programmers</a> at the<a href="https://en.wikipedia.org/wiki/Lawrence_Journal-World"> <em>Lawrence Journal-World</em></a> newspaper.</p><p>Basically , Django is a python based, free and open source web framework, used to develop the back-end part of a website.</p><h4><strong>More about Django</strong></h4><p>Out of many existing architectural patterns in the software engineering field, Django is somewhat based on a pattern called MVC i.e, Model View Controller. It is ‘somewhat’ because Django development is related to the newspaper industry, so following the historical pattern the developers decided to keep the control part of the MVC to Django itself and made it what they call an MVT architecture. The MVT stands for Model View Template. Don’t worry if these terms feel like going over your head, because I myself being a noob Django developer don’t know much about this (I am with you in this). Still I’ll try to explain (Because I need to have content to finish writing this blog).</p><h4><strong>How does this work?</strong></h4><p>OK, so after luring you in by telling cooked up stories mixed with some facts, now is the time to preach you about the working process of Django using my very little understanding of the subject. So let’s start this with a story about the journey of a pigeon walking down the Django lane.</p><p>Once upon a time a User clicked on a link.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*6sSK7DwzoHOP_0lWssY3sA.png" /><figcaption>Home-page of the website</figcaption></figure><p>We will call it URL because it fits the narrative of the story and also Pigeon here stands for the piece of information traveling from one file to the other file.</p><p>So after the user clicked, the pigeon came to a file named “<strong>urls.py</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/0*psg61uXCcQQgSQ5L" /><figcaption>address of views are stored here. The 1st line in urlpatterns list has the address of a view called home and the 2nd line has that of scoreListView.</figcaption></figure><p><em>urls.py</em> was a house full of links. Luckily the pigeon could identify the link that was meant for him. When he read the message written at those links he found out that each of those urls contains an address to a particular section of a particular place.</p><p>Now from there he headed towards a file named “<strong>views.py</strong>” (View part of the MVT).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*RDmEPz4q0bVgrcAJ" /><figcaption>a view takes a web request and also return a web response. Here home is a function based view and scoreListView is a class based view.</figcaption></figure><p>After reaching<strong> </strong><em>views.py</em>, he came to know that the place is a big building having various rooms that contain the logic behind the functionalities implemented on the front-end, the place from where the pigeon started his journey. Each room was called ‘view’, some of them were functions and some of them were classes. Now after looking at the information pigeon had, it didn’t take him much time to find the exact view he needed to talk to. In order to communicate with the view, the pigeon had to make a request and also had to hand over any additional parameters it had for that view.</p><p>Now that view started working on the request that pigeon made. And to fulfill that it had to implement the code written inside it. Now the thing is that those logic required some interaction with the database. So for that purpose the view commanded an insect to do that job.</p><p>So while fulfilling his duty the insect found out about a place called “<strong>models.py</strong>”. (Model part of the MVT architecture)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/0*KcsuAKl7p9KFvT6b" /><figcaption>models.py contains several models. Generally each models maps to a single database table. Here there is only one model named scorecard.</figcaption></figure><p>While he was returning after gathering the information he met some of his fellow insects. When they asked him about the <em>models.py</em>, he told them that it’s a place used to create the tables and all to store data in the database. Then someone confronted him that isn’t this the thing we do in MySQL or something like that? Then in reply he first used a term <strong>ORM</strong> so that the people asking questions consider him knowledgeable and then in further continuation, he told them that the <strong>ORM</strong> is basically<em> </em><strong><em>object relational mapping</em></strong>. Knowing that they wouldn’t understand a thing just by full form, he said and I quote “<em>Do you all know what DC does with it’s superheroes, they keep the costumes same but they change the actor playing it. This is what an ORM is. Because similarly in models.py you write in a language named python so that the costume remains the same but you can change the database query language as per your need and the Django handles the workload for that part.</em>”</p><p>After teaching them about the Models, the insect came back to the view and handed over the required data. View used those data to gather some information and stored that in a dictionary named context. Then the view called pigeon and handed over the response for the request he made and along with that the view also gave him the context dictionary and told him to go to a place named<strong> Template</strong>(T part of the MVT architecture).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jOBx5bNkjg2u9lgl" /><figcaption>A template contains the static parts of the desired HTML output as well as some special syntax describing how dynamic content will be inserted.</figcaption></figure><p>After looking at the pigeon, who looked confused, the View said “<em>You must be wondering what Template is. If I say in simple language then </em><strong><em>Template is basically HTML on steroids.</em></strong><em> As other than HTML it also can implement loops and conditionals. It also uses the variables from the context dictionary to make a page which is visible to the user that sent you here</em>”. After listening to that the pigeon went to that place and gave the context dictionary to the templates and after taking the required web page the pigeon finally got to meet the user, waiting for him since the beginning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LTPdC7SsbLlc1218" /><figcaption>final page that the user wanted after clicking on that link</figcaption></figure><h4>Summary</h4><p>So the summary is a user clicks on a url, the url contains a path to a view and that view then interacts with the database via models and then after implementing the logic inside itself it redirects to the template with a dictionary and then the template uses the information from that dictionary to build the web page that the viewer wants. And this is how the circle got completed and we got a happy ending for our story.</p><p>Hope you had fun while learning the basics of Django. Now it’s your turn to walk up to it and say Hi. Also feel free to drop your valuable suggestions in the comments section below. Good luck for your journey ahead.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b6e1646aa56" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>