<?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 Akshay Gupta on Medium]]></title>
        <description><![CDATA[Stories by Akshay Gupta on Medium]]></description>
        <link>https://medium.com/@aksgupta98?source=rss-e2dc4e74ef5a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NyNZ6fwROneBYzu7.jpg</url>
            <title>Stories by Akshay Gupta on Medium</title>
            <link>https://medium.com/@aksgupta98?source=rss-e2dc4e74ef5a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:46:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aksgupta98/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[Django in a Nutshell for Beginners]]></title>
            <link>https://write.agrevolution.in/django-in-a-nutshell-for-beginners-7db80447ddf6?source=rss-e2dc4e74ef5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7db80447ddf6</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Akshay Gupta]]></dc:creator>
            <pubDate>Wed, 01 Dec 2021 10:07:25 GMT</pubDate>
            <atom:updated>2021-12-02T08:20:52.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qKpwzxgqSxZwrv6pPtHhtA.jpeg" /></figure><p>Django is one of the best Web-development frameworks because of numerous reasons. User-friendliness of Python Language, Stellar Documentation, Admin Interface, Huge Community — Django checks them all.</p><p>In this article, we will explore the basic architecture of the Django Web Application.</p><h3><strong>Apps</strong></h3><p><em>Why do we need apps when we are designing a web application?</em></p><p>Django lets users create different functionalities in a distributed manner (in the form of Apps). So each Django app serves a particular purpose in a bigger web application.</p><p>For example, if you are building an e-commerce website, you can create a total of 3 apps — one for displaying product information, one for managing user profiles, and the other for managing payments.</p><p>Distributing your entire web application into small components in the form of Apps makes it easy for developers to make changes and maintain the code.</p><p>In Django, an app can be created simply by:</p><pre>python manage.py startapp <em>AppName</em></pre><p>Now that we know what an App is, let us dive deeper and understand the components of an App.</p><p>Django app consists of three major components:</p><ul><li>Models</li><li>URLs</li><li>Views</li></ul><p>Let us understand these 3 components better.</p><h4>Models</h4><p>Models define the structure of the data you want to capture. It contains the essential fields and behaviors of the data you’re storing.</p><p>Suppose you want a user to enter his name, email, mobile number, etc. while signing up on your website then you can instruct Django to allow only certain data types for these fields. For example, a mobile number should be an integer-only field with length restrictions, or an email id should be in form of user@xyz.com</p><p>This can be easily done via models:</p><pre>from django.db import models</pre><pre>class User(models.Model):<br>    name = models.CharField(max_length=30)<br>    email_id = models.EmailField(max_length=254)<br>    phone_no = models.IntegerField(max_length=10)</pre><p>There are various types of fields that one can choose from. A consolidated list of the same can be obtained <a href="https://docs.djangoproject.com/en/3.2/ref/models/fields/#field-types">here.</a></p><h4>URLs</h4><p>Now that we know what type of information we have to capture from a user, let us figure out when shall the user be prompted to fill up this information.</p><p>As soon as a user visits a particular route, he should be shown details pertaining to that route. For example, if a user visits the <em>login</em> route, then the user should land on a page that lets him enter his credentials to log into the application.</p><p>In Django, this URL-webpage mapping is done through the <em>urls.py</em> file. In this file, you mention the route (e.g. /login, /signup, /dashboard, etc) and map that route to a webpage (e.g. login-page, signup-page, etc.)</p><h4>Views</h4><p><em>Views.py</em> file describes what a user sees while visiting a website (or a route). It can have HTML, CSS, JS components. This file also contains the logic to display webpage components in a particular format (For e.g.: Sorting, Filtering, etc)</p><p>This is a basic snippet of the <em>views.py</em> file:</p><pre>from django.shortcuts import render<br>from .models import User</pre><pre>def home(request):<br>    users=User.objects.all()<br>    data={<br>        &#39;users&#39;:users,<br>    }<br>    return render(request,&#39;my-website/home.html&#39;,data)</pre><p>N.B. In the above snippet, all the styling-related code will be located in the <em>home.html </em>file under the <em>my-website</em> directory.</p><p>In this article, we got a basic sense of what an app is in Django and what are its components. Will highly appreciate your feedback and suggestions regarding this article. Until next time.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7db80447ddf6" width="1" height="1" alt=""><hr><p><a href="https://write.agrevolution.in/django-in-a-nutshell-for-beginners-7db80447ddf6">Django in a Nutshell for Beginners</a> was originally published in <a href="https://write.agrevolution.in/">DeHaat</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>