

{"id":57415,"date":"2019-06-01T17:56:20","date_gmt":"2019-06-01T12:26:20","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=57415"},"modified":"2021-06-21T12:19:29","modified_gmt":"2021-06-21T06:49:29","slug":"django-static-files-handling","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/","title":{"rendered":"Django Static Files Handling made Simple &#8211; Even your Kids can do it!"},"content":{"rendered":"<p>Today, websites have become much more interactive than ever. They contain tons of CSS and JavaScript Code to make our experience smoother.<\/p>\n<p>There are lots of graphics involved on websites too. Our <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/python-tutorials-home\/\">Python Tutorials Home Page<\/a><\/strong><\/em> is the best example. There are outputs and screenshots and these images are important for the blog. So, from this, we can state that there are multiple files on a webpage.<\/p>\n<p>Important point is that <em>none of these files can be modified by the server<\/em>. It means these files are transmitted as it is, without any modification.<\/p>\n<h3>What are Static files?<\/h3>\n<p><em>Static files are those files which can not be processed, generated or modified by the server.<\/em><\/p>\n<p>In the previous section, we learned about the concept of static files. There is a catch here. Images, JavaScript files, etc are types of content or static files. Static files contain all kinds of file types \u2013 from .mpeg, .jpeg to .pdf, etc.<br \/>\nThere is a simple concept of working with static files. When a user requests for a webpage, the server will generate the HTML. Then the server will collect all the corresponding static files related to that page. Lastly, this whole data is served.<\/p>\n<p>You can see that process in this flow-diagram. Also, we can say that static websites are much faster than dynamic websites.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57501\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1.jpg\" alt=\"Django Static Files Working Diagram\" width=\"944\" height=\"157\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1.jpg 944w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1-150x25.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1-300x50.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1-768x128.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Diagram-1-520x86.jpg 520w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/a><\/p>\n<h4>Benefits of Static Files<\/h4>\n<ul>\n<li><strong>They are static<\/strong>: These files don\u2019t change until the developer replace them with a new one. Thus, the server just fetches them from the disk, taking a minimum amount of time.<\/li>\n<li><strong>Static files are easier to cache:<\/strong> They don\u2019t change and are not modified by the server. That makes the performance faster.<\/li>\n<li><strong>Static files are energy efficient:<\/strong> Static files are fetched from the disk when required. They require no processing which saves the processing overhead and website response becomes fast.<\/li>\n<\/ul>\n<p>Let\u2019s understand one more important topic, i.e. Template Inheritance.<\/p>\n<h3>What is Template Inheritance?<\/h3>\n<p>Static files improve the performance of the website. Developers use it more efficiently with template inheritance method and it is one of <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/django-features\/\">Django\u2019s key features<\/a>.<\/strong><\/em><\/p>\n<p>The basic concept is that: We define the common parts of a webpage, such as navigation bars and About section. All these parts are essentially HTML and some static files. Majority of webpages will contain similar sections.<\/p>\n<p>The problem is that when there are lots of webpages, the modification becomes complex. Suppose we want to modify the About section. Then, the developer will have to change the code on every single page. That will lead to chaos and will definitely generate bugs.<\/p>\n<p>Django templating solves this problem, by inheritance. It provides us with the modularity of developing different sections of a webpage. Like we can define a base template, which contains nav bars and About section. Then inherit this page and just add the unique part in other webpages.<\/p>\n<p>Now, let\u2019s implement template inheritance in a project.<\/p>\n<h3>Making a Project<\/h3>\n<p><strong>1. Create a New Django application<\/strong><\/p>\n<p>First, we will create a new Django application. For that, start your virtual environment in command prompt. Then go to the root folder. After that, execute this command in terminal\/ PowerShell.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python manage.py startapp home<\/pre>\n<p>This application will contain all the templates. We will practice on this application in further sections of this article.<\/p>\n<p>Now, install that application in your Django project.<\/p>\n<p>Add this name to INSTALLED_APPS list.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57459\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy.png\" alt=\"Django Static Files settings.py\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-settingspy-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>2. Define Some View Functions<\/strong><\/p>\n<p>Let\u2019s define some view functions for this project. Add this code to your home\/views.py file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.shortcuts import render\r\n\r\n#DataFlair #Views #TemplateInheritance\r\n# Create your views here.\r\ndef home(request):\r\n    return render(request, 'base.html')\r\n\r\ndef other(request):\r\n    context = {\r\n    'k1': 'Welcome to the Second page',\r\n    }\r\n    return render(request, 'others.html', context)\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57461\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy.png\" alt=\"Django Static Files views.py\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-viewspy-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>These are some simple view functions.<\/p>\n<p><strong>3. Defining Templates<\/strong><\/p>\n<p>Now, we can define our templates. First, create a new folder template in the home app. Inside that folder, create two new files, base.html, and others.html.<\/p>\n<p>Then just paste this code in base.html<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;HomePage&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;center&gt;\r\n    &lt;h1&gt;DataFlair Django Tutorials&lt;\/h1&gt;\r\n{% block body_block %}\r\n&lt;h1&gt;Welcome to the Home-Page&lt;\/h1&gt;\r\n&lt;h2&gt; search for others\/ &lt;\/h2&gt;\r\n      &lt;h2&gt;\u00a0we\u00a0are\u00a0in\u00a0the\u00a0block\u00a0of\u00a0home\u00a0page&lt;\/h2&gt;\r\n{% endblock %}\r\n&lt;\/center&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57524\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page.png\" alt=\"Django static files block of home page\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-block-of-home-page-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><em><strong>Don&#8217;t forget to check the <a href=\"https:\/\/data-flair.training\/blogs\/create-django-templates\/\">Django Template Tutorial<\/a><\/strong><\/em><\/p>\n<p><strong>Understand the Code:<\/strong><\/p>\n<p>In this code, you must be noticing that we used some new template tags. The tag,<strong> {% block body_block %}<\/strong> is used for template inheritance. We are actually replacing this section of code between <strong>{% block body_block %}<\/strong> \u2026. <strong>{% endblock %}<\/strong>. The name body_block can be of your choice.<\/p>\n<p>There can be multiple blocks of this type. It\u2019s up to you to change them or use them as it is.<\/p>\n<p>Now, paste this code in others.html<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{% extends \"base.html\" %}\r\n{% block body_block %}\r\n    &lt;h2&gt; search for \/ &lt;\/h2&gt;\r\n    &lt;h1&gt;{{ context.k1 }}&lt;\/h1&gt;\r\n{% endblock %}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57466\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml.png\" alt=\"Django Static Files others.html\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-othershtml-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understand the code:<\/strong><\/p>\n<p>Here, we used a new tag at the beginning. <strong>{% extends \u2018base.html\u2019 %}<\/strong> is clear in itself. This tag will inform Django to add base.html code in others.html. After that we used <strong>{% block body_block %}<\/strong> \u2026. <strong>{% endblock %}<\/strong>, which contains this page\u2019s unique content. This block is swapped with the block in base.html.<\/p>\n<h4><strong>4. URL Mappings<\/strong><\/h4>\n<p>We have to connect our views and urls. So, edit the urls file.<\/p>\n<p>Make a new urls-config in the home app.<\/p>\n<p>Inside home\/urls.py file, paste this<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.urls import path\r\nfrom .views import *\r\nurlpatterns = [\r\n    path('', home, name = 'homepage'),\r\n    path('other\/', other, name = 'otherpage'),\r\n]<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57467\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy.png\" alt=\"Django static files urls.py\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files-urlspy-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Now, add this variable in your main urls-config-<\/p>\n<p>urls.py, in root folder<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">path('', include('home.urls')),<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57469\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2.png\" alt=\"Django static Files urls.py 2\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-Files-urlspy-2-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><em><strong>Must Learn &#8211;<a href=\"https:\/\/data-flair.training\/blogs\/django-urls-and-urlconf\/\"> How to map URL patterns to view functions<\/a><\/strong><\/em><\/p>\n<h4><strong>5. Test Run<\/strong><\/h4>\n<p>Finally, test our functions. See through it that you have followed the whole tutorial.<\/p>\n<p>In URL bar, enter &#8211; localhost:8000<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57470\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body.png\" alt=\"local.php body search for others\/\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/local.php-body-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Then search for other\/ in the URL bar.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57473\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host.png\" alt=\"Django Static Files local host\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-local-host-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>So, this is the output.<\/p>\n<p>That\u2019s how we perform template inheritance.<\/p>\n<p>Remember, there can be multiple blocks in a single template.<\/p>\n<p>Now, we will add some static files so that our page looks more attractive. We will be modifying our settings.py a little bit.<\/p>\n<h3>Managing Static Files in Django<\/h3>\n<p>A good developer also manages static files. Static file management is an important factor in web development. When the website undergoes frequent UI changes and graphics are updated constantly, this condition requires developers to manage static files.<\/p>\n<p>Django provides us with built-in static file handler. It\u2019s a very simple concept and requires some modification in settings.py.<\/p>\n<p>Check the list of <strong>INSTALLED_APPLICATIONS<\/strong> in settings.py file.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57476\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts.png\" alt=\"Django Static Files allowed hosts\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-allowed-hosts-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Application is: <strong>django.contrib.staticfiles<\/strong><\/p>\n<p>Moving to the next phase, we have STATIC_URL variable in the last section of the page.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57477\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code.png\" alt=\"Django Static Files language code\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-language-code-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>This URL is important as it will be the base URL for all static files of your project. This URL should be of the same name as the folder where your static file is stored.<\/p>\n<p>Then another important setting comes in &#8211; STATIC_ROOT. This setting contains the address of the folder where we will be storing static files. When we execute the collectstatic command, the Django will store our files in this directory.<\/p>\n<p>The last is a list of directories &#8211; STATICFILES_DIRS. This list has file-paths of the folders where we store our static files. When we execute the collectstatic command, Django will look for static files in these directories. Then it will save them in our STATIC_ROOT folder.<\/p>\n<h4><strong>collectstatic command<\/strong><\/h4>\n<p>This command is very useful when the website is in production state. When this command is executed, Django performs these operations:<\/p>\n<ul>\n<li>It looks for static files in all the directories listed in STATICFILES_DIRS<\/li>\n<li>The static-files are then copied and saved in STATIC_ROOT directory.<\/li>\n<li>When the server is requested for static content, it will fetch a file from STATIC_ROOT.<\/li>\n<li>And, that file will have its URL modified with STATC_URL.<\/li>\n<\/ul>\n<p>That\u2019s how files are served.<\/p>\n<p><em><strong>Have you checked &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/django-forms-handling-and-validation\/\">Django Forms Handling &amp; Validation<\/a><\/strong><\/em><\/p>\n<h4>1. Setting up Static Files<\/h4>\n<p>Let\u2019s add some static files to our home app. Just add this code in your setting file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">#DataFlair #Django #Static files\r\nSTATIC_URL = '\/static\/'\r\n#--------------------------------------------------\r\nSTATIC_ROOT = os.path.join(BASE_DIR, 'root')\r\n#-----------------------------------------------------\r\nSTATICFILES_DIRS = [\r\n        os.path.join(BASE_DIR, 'static'),\r\n]<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-57478 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS.png\" alt=\"Django Static Files DIRS\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-DIRS-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Here, you can note that we are not using the STATIC_ROOT has a different value. But, that\u2019s fine since we defined Root.<\/p>\n<p>You can test it for some errors here. Try executing this command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python manage.py collectstatic<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57479\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static.png\" alt=\"Django Static Files collect static\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>If it succeeds then no issues, we can move forward.<\/p>\n<p>Now, make a new folder named static same as we named in STATIC_DIRS list. Inside that, make a new folder image and in that folder, store image1.jpeg. This file can be anything that you want to display.<\/p>\n<p>Again run the command: <strong>collectstatic<\/strong><\/p>\n<p>This time, it shall produce this output.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57480\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2.png\" alt=\"Django Static Files collect static 2\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-collect-static-2-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>It shows that one file is added, then move forward. Otherwise, comment on any errors or check all the steps prior to this point.<\/p>\n<h4>2. Editing Templates for Static files<\/h4>\n<p>Now, we will edit some templates in the home app. Add a new template <strong>about.html<\/strong> in the templates folder.<\/p>\n<p>Then, paste this code in the file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">{% extends 'base.html' %}\r\n{% block body_block %}\r\n{% load static %}\r\n    &lt;img src = \"{% static 'images\/image1.jpg' %}\"&gt;\r\n    &lt;h1&gt;This is about the developers of this webpage&lt;\/h1&gt;\r\n    &lt;h2&gt;Django is the best framework&lt;\/h2&gt;\r\n    &lt;h1&gt;DataFlair Team&lt;\/h1&gt;\r\n    &lt;h2&gt;Year : {{ time | date:'Y' }}&lt;\/h2&gt;\r\n    &lt;h2&gt;Month : {{ time | date:'M' }}&lt;\/h2&gt;\r\n{% endblock %}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57482\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends.png\" alt=\"Django Static Files Extends\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-Static-Files-Extends-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Understand the Code:<\/strong><\/p>\n<p>See the 3rd line.<strong> {% load static %}<\/strong>\u00a0tag will inform <a href=\"https:\/\/www.djangoproject.com\/\">Django<\/a> that there are static files in this template. Django will then check for the related static files. Then sends them together with the HTML code.<\/p>\n<p>After that, we gave the src of the image tag. The source of image tag is a Django tag. Here we used static keyword and the path to the image. The path is not specified from the root directory.<\/p>\n<p>The STATIC_URL value is automatically added to the source of the image file, even though it is coming from a different directory altogether.<\/p>\n<p>After that, we have used filters &#8211;<strong> {{ time |date:\u2018Y\u2019}}<\/strong>.<\/p>\n<h4>What are Django Template Filters?<\/h4>\n<p>The | pipe character indicates the use of template filters. Here, the time dictionary contains a\u00a0<strong><em><a href=\"https:\/\/data-flair.training\/blogs\/python-datetime-module\/\">Python DateTime object<\/a><\/em><\/strong>. Then, we wanted to print only year, therefore we used a date filter. This will chop-off all other parts except year from time.<\/p>\n<p>Template filters are used to make data received from the server more presentable. There are lots of filters to customize the look and feel of the data received. We can also create our own custom data filters. It\u2019s a vast topic and needs a blog of its own. We will be covering the same in upcoming articles.<\/p>\n<h4>3. Editing View Functions<\/h4>\n<p>Let\u2019s make a new view function. Just add this function to your home\/views.py.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">import datetime\r\ndef about(request):\r\n    time = datetime.datetime.now()\r\n    return render(request, 'about.html',{'time': time})<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57484\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time.png\" alt=\"Views.py import date time\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Views-py-import-date-time-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>We imported the datetime class to use its methods. We are then passing the same to our about.html.<\/p>\n<h4>4. Editing urls.py<\/h4>\n<p>This time, we are changing the urls file. We will be using relative urls here. They are a professional way of inserting urls in templates and are really helpful.<\/p>\n<p>Paste this code in home\/urls.py<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from django.urls import path\r\nfrom .views import *\r\nurlpatterns = [\r\n    path('', home, name = 'homepage'),\r\n    path('other\/', other, name = 'otherpage'),\r\n    path('about\/', about, name = 'about'),\r\n]<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57485\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about.png\" alt=\"urls.py path other page &amp; about\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/urls-py-path-other-page-about-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>In this part, just remember the name parameter. They will be very useful.<\/p>\n<h4>5. Adding Bootstrap<\/h4>\n<p>Bootstrap is one of the most popular front-end frameworks. It contains pre-defined CSS and <strong><a href=\"https:\/\/data-flair.training\/blogs\/javascript-class\/\">JavaScript classes<\/a><\/strong> for rapid development. So, today we are going to add the CSS version of Bootstrap to our project.<\/p>\n<p>In home\/templates\/base.html paste this.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;HomePage&lt;\/title&gt;\r\n\t&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz\/K68vbdEjh4u\" crossorigin=\"anonymous\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;center&gt;\r\n\t\t &lt;nav class=\"navbar navbar-default navbar-static-top\"&gt;\r\n      &lt;div class=\"container\"&gt;\r\n        &lt;ul class=\"nav navbar-nav\"&gt;\r\n          &lt;li&gt;&lt;a class=\"navbar-brand\" href=\"{% url 'homepage' %}\"&gt;HomePage&lt;\/a&gt;&lt;\/li&gt;\r\n          &lt;li&gt;&lt;a class=\"navbar-link\" href=\"{% url 'admin:index' %}\"&gt;Admin&lt;\/a&gt;&lt;\/li&gt;\r\n          &lt;li&gt;&lt;a class=\"navbar-link\" href=\"{% url 'otherpage' %}\"&gt;Other&lt;\/a&gt;&lt;\/li&gt;\r\n          &lt;li&gt;&lt;a class=\"navbar-link\" href=\"{% url 'about' %}\"&gt;About&lt;\/a&gt;&lt;\/li&gt;\r\n        &lt;\/ul&gt;\r\n      &lt;\/div&gt;\r\n    &lt;\/nav&gt;\r\n    &lt;div class=\"container\"&gt;\r\n    \t    &lt;h1&gt;DataFlair Django Tutorials&lt;\/h1&gt;\r\n{% block body_block %}\r\n&lt;h1&gt;Welcome to the Home-Page&lt;\/h1&gt;\r\n&lt;h2&gt; search for others\/ &lt;\/h2&gt;\r\n&lt;h2&gt;we are in the block of home page&lt;\/h2&gt;\r\n{% endblock %}\r\n&lt;\/center&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57525\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block.png\" alt=\"base.html end block\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/base.html-end-block-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Understand the Code:<\/strong><\/p>\n<p>In this base.html, we have added some new elements. Let\u2019s understand them one by one.<\/p>\n<p><strong>Bootstrap CSS:<\/strong> &lt;link&gt; tag is used to add CSS file from Bootstrap. Here rather than original CSS file, we just added the server URL of the same. This path can be directly copied from the Bootstrap website, its an opensource project.<\/p>\n<p>Then we used some bootstrap classes with HTML. The classes like <em>navbar, navbar-nav, navbar-link,<\/em> etc are all Bootstrap CSS classes. They are just for front-end and to give you an idea of bootstrap. You can get more details on https:\/\/getbootstrap.com\/<\/p>\n<p><strong>The href of anchor tags:<\/strong>\u00a0This is the implementation of relative urls. See the urls in the href attribute of &lt;a&gt; tags. Instead of using complete urls, we are actually calling view functions directly. In the previous section, we stated you to remember names in urls.<\/p>\n<p>The {% url \u2018url_name\u2019 %} is replaced by the actual URL. And, this is very helpful for bigger projects.<\/p>\n<p>The main advantage is that you can name the function. So, instead of URL (which could go wrong), we write url-name.<\/p>\n<h4>6. Collecting Static Files<\/h4>\n<p>Then again run this command of collecting static files.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">python manage.py collectstatic<\/pre>\n<p>We have already discussed in the previous section what this command does.<\/p>\n<p>If you get no errors, then move forward.<\/p>\n<h4>7. Test Run<\/h4>\n<p>At last, we will test it. Start your project&#8217;s server.<\/p>\n<p>Search in the URL bar: localhost:8000<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57488\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements.png\" alt=\"local.php pseudo elements\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/localphp-pseudo-elements-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>Notice those links and navigation bar. It was all bootstrap. Bootstrap is very powerful and perfect for frontend developers.<\/p>\n<p>Now, you can test on different links if they work properly.<\/p>\n<p>Click on <strong>About<\/strong> link in the navigation bar.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-57489\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials.png\" alt=\"Local host Django tutorials\" width=\"1920\" height=\"1030\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials-768x412.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials-1024x549.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Local-host-Django-tutorials-520x279.png 520w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p>And, other links shall work well too. There are two important things regarding about.html<\/p>\n<p>It is serving a static file and the image.<\/p>\n<p>The year and month printed are rendered by the server. They are formatted with template filters.<\/p>\n<p>Look at the code of about.html. we used template inheritance with base.html. that made our website pretty good, with all that navigation bar. We can change whatever we want with that. It will never affect the about.html. that\u2019s one of the reasons for faster development with Django.<\/p>\n<h3>Summary<\/h3>\n<p>We learned a lot of interesting concepts from this article. The topics are as follows:<\/p>\n<ul>\n<li>Template inheritance<\/li>\n<li>Django Static Files<\/li>\n<li>Template Filters<\/li>\n<li>Bootstrap addition in templates<\/li>\n<li>Using relative urls<\/li>\n<\/ul>\n<p>These concepts can be a bit complex. Therefore, if you face any issues, you can freely comment your query below. We will try to resolve your doubts as soon as possible.<\/p>\n<p><em><strong>Find all the questions for your Django interview preparation in a single guide &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/django-interview-questions\/\">Django Interview Questions<\/a><\/strong><\/em><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1246,&quot;href&quot;:&quot;https:\\\/\\\/www.djangoproject.com&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251208010225\\\/https:\\\/\\\/www.djangoproject.com\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 04:15:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-12 06:50:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-15 08:09:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-18 08:29:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-21 12:48:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-24 17:29:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-27 18:33:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-30 20:13:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-02 22:39:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-06 00:32:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-09 01:45:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-12 02:16:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-15 05:26:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-18 06:34:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-21 07:06:27&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-24 08:35:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-27 11:07:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-30 13:33:21&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-02 13:50:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-05 17:18:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 04:54:23&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 05:53:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 06:19:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-18 07:25:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-21 07:39:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-24 10:18:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 11:03:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-02 12:35:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-05 13:19:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-08 17:33:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-11 19:44:06&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-14 21:17:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-18 03:06:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-21 13:57:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 14:25:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-27 14:29:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-30 19:17:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 06:28:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 14:26:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 17:17:54&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-13 08:22:52&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-16 08:54:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-19 17:45:34&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-22 19:40:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-26 05:52:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-29 06:55:09&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-02 09:28:51&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-05 17:31:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-08 17:47:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-12 04:11:05&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-15 07:45:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-18 10:46:46&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-21 11:47:35&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-24 15:16:59&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-27 16:17:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-05-30 18:32:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-03 02:42:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-06 03:37:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-09 13:48:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-12 21:24:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-16 06:25:43&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-16 06:25:43&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, websites have become much more interactive than ever. They contain tons of CSS and JavaScript Code to make our experience smoother. There are lots of graphics involved on websites too. Our Python Tutorials&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":57504,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19149],"tags":[19994,20000,20001],"class_list":["post-57415","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","tag-django-static-files","tag-static-files-benefits","tag-static-files-management-in-django"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Django Static Files Handling made Simple - Even your Kids can do it! - DataFlair<\/title>\n<meta name=\"description\" content=\"With Django static files tutorial, you will learn the concept of static files, project creation process and static files management in Django. Explore now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Django Static Files Handling made Simple - Even your Kids can do it! - DataFlair\" \/>\n<meta property=\"og:description\" content=\"With Django static files tutorial, you will learn the concept of static files, project creation process and static files management in Django. Explore now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-01T12:26:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-21T06:49:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Django Static Files Handling made Simple - Even your Kids can do it! - DataFlair","description":"With Django static files tutorial, you will learn the concept of static files, project creation process and static files management in Django. Explore now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/","og_locale":"en_US","og_type":"article","og_title":"Django Static Files Handling made Simple - Even your Kids can do it! - DataFlair","og_description":"With Django static files tutorial, you will learn the concept of static files, project creation process and static files management in Django. Explore now!","og_url":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-06-01T12:26:20+00:00","article_modified_time":"2021-06-21T06:49:29+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Django Static Files Handling made Simple &#8211; Even your Kids can do it!","datePublished":"2019-06-01T12:26:20+00:00","dateModified":"2021-06-21T06:49:29+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/"},"wordCount":2213,"commentCount":7,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files.jpg","keywords":["Django Static Files","Static Files Benefits","Static Files Management in Django"],"articleSection":["Django Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/","url":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/","name":"Django Static Files Handling made Simple - Even your Kids can do it! - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files.jpg","datePublished":"2019-06-01T12:26:20+00:00","dateModified":"2021-06-21T06:49:29+00:00","description":"With Django static files tutorial, you will learn the concept of static files, project creation process and static files management in Django. Explore now!","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/django-static-files-handling\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/06\/Django-static-files.jpg","width":802,"height":420,"caption":"Django static files Topics"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/django-static-files-handling\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Django Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/django\/"},{"@type":"ListItem","position":3,"name":"Django Static Files Handling made Simple &#8211; Even your Kids can do it!"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/57415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=57415"}],"version-history":[{"count":14,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/57415\/revisions"}],"predecessor-version":[{"id":97668,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/57415\/revisions\/97668"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/57504"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=57415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=57415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=57415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}