<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ashish</title>
    <description>The latest articles on Forem by Ashish (@ashishmakes).</description>
    <link>https://forem.com/ashishmakes</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1039584%2F0fdb1568-0932-4172-b0bf-bb72fd9fab33.jpeg</url>
      <title>Forem: Ashish</title>
      <link>https://forem.com/ashishmakes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ashishmakes"/>
    <language>en</language>
    <item>
      <title>How to Setup your First Django Project | The Best and Simplest Way</title>
      <dc:creator>Ashish</dc:creator>
      <pubDate>Fri, 12 Jan 2024 21:19:35 +0000</pubDate>
      <link>https://forem.com/ashishmakes/how-to-setup-your-first-django-project-the-best-and-simplest-way-pem</link>
      <guid>https://forem.com/ashishmakes/how-to-setup-your-first-django-project-the-best-and-simplest-way-pem</guid>
      <description>&lt;p&gt;While starting with learning Django, its very crucial to know what should be the best and the simplest way to setup your Django project.&lt;/p&gt;

&lt;p&gt;Python's django framework is not something like the usual HTML, CSS and JavaScript project which you only deals with a few files, even the simples django project includes various files such as views.py, urls.py, models.py, settings.py, forms.py then the various folders such as staticfiles, templates which themselves includes various files. Its becomes even more complicated when you are working on a big django project.&lt;/p&gt;

&lt;p&gt;This clearly explains Why there is a need to setup and manage django projects properly. In this tutorial today I will be sharing my way to setup the django project from creating the new django project to launching it on localhost. If you wan to know How to Deploy your Django Project Online for Free then I have also posted the website I use the most to host my django projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can also get my FREE eBook related to &lt;a href="https://github.com/ashish-makes/django-setup/files/13924044/Professionally.setup.Django.project.pdf"&gt;A Comprehensive Guide to Setting Up Django Projects&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypc92xqibdjtxbhdv3al.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypc92xqibdjtxbhdv3al.png" alt="A-Comprehensive-Guide-to-Setting-Up-Django-Projects" width="800" height="1395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Best way to setup a Django project
&lt;/h2&gt;

&lt;h3&gt;
  
  
  General Steps
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To start with lets create a folder say django-setup, in this folder we will have our project setup.&lt;/li&gt;
&lt;li&gt;Now open this folder in the code editor of your choice, here I will be using VS Code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Creating virtual environment
&lt;/h3&gt;

&lt;p&gt;Now we will setup a virtual environment t work with.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install virtualenv using the command below in your terminal.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install virtualenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Once the library is installed, now lets go back to the step 2 where we opened the folder in vs code, in terminal type the command below to create a virtual environment.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;py -m venv venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsw9v9ifksldq0cbhxg8v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsw9v9ifksldq0cbhxg8v.png" alt="creating-virtual-enviornment" width="705" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of venv you can name your environment anything such as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;py -m venv django-venv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Activating virtual environment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Once the virtual environment is created, we will now activate the environment. To activate the virtual environment in your terminal type
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd venv\scripts ; ./activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foo19n9b3h10fk9k5ubmj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foo19n9b3h10fk9k5ubmj.png" alt="activating-virtual-enviornment" width="703" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will activate the virtual environment and we are ready to work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Django
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now install Django by typing the command below in the terminal.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install django
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps7ni5dr9da28mehpqri.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps7ni5dr9da28mehpqri.png" alt="installing-django" width="702" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating django project
&lt;/h3&gt;

&lt;p&gt;We are all set to start creating and working with our django project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To create django project type the command below in the terminal
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django-admin startproject &amp;lt;project name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgt6kxpmlzq55l4mh57ka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgt6kxpmlzq55l4mh57ka.png" alt="creating-django-project" width="702" height="142"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure to replace &lt;code&gt;&amp;lt;project name&amp;gt;&lt;/code&gt; with your desired project name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating django app
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now head over and open the project folder using &lt;code&gt;cd&lt;/code&gt; command and run the command below to create django app.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;py manage.py startapp &amp;lt;app name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fluepom40eydpjemcph31.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fluepom40eydpjemcph31.png" alt="creating-django-app" width="707" height="156"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure to replace &lt;code&gt;&amp;lt;app name&amp;gt;&lt;/code&gt; with your desired app name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating static folder
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In the project's root directory now create a new folder named static which will include all the static files such as stylesheets, javascript files, image files and so on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9r3v2vdqiw9p1zb6uucq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9r3v2vdqiw9p1zb6uucq.png" alt="static-folder" width="281" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the static folder now create three different folders named css, js, img.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Creating templates folder
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In the project's root directory now create a new folder named templates which will include all the HTML pages such as base.html, index.html, about.html, contact.html and so on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps64s6mglhb7cxfq5wdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps64s6mglhb7cxfq5wdt.png" alt="tmplates-folder" width="285" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the static folder now create your desired HTML pages like base.html, index.html, about.html, contact.html.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Updating settings.py
&lt;/h3&gt;

&lt;p&gt;Now we will make some changes to settings.py file which is present in your project folder.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Import the os module a the top of settings.py file as shown in the image below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa9dqmf8hf0o3gubkxq1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa9dqmf8hf0o3gubkxq1m.png" alt="updating-settings-py" width="800" height="497"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add your app to the installed apps as shown below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'new_app'
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;os.path.join(BASE_DIR, 'templates'&lt;/code&gt; to TEMPLATES as shown below&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb0judi9ylh0acfdwrc8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb0judi9ylh0acfdwrc8k.png" alt="templates" width="800" height="408"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Right below &lt;code&gt;STATIC_URL = 'static/'&lt;/code&gt; add the given code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnjn9wqvcz9udndzadj2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnjn9wqvcz9udndzadj2b.png" alt="static" width="800" height="213"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this step we have completed to update the settings.py file, now lets move on to the further steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating urls.py file present in the project folder
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now open the urls.py file located in the django project folder and replace the code with the code given below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('&amp;lt;your_app_name&amp;gt;.urls')),
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure to replace &lt;code&gt;&amp;lt;your_app_name&amp;gt;&lt;/code&gt; with your actual app name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating urls.py file in app folder
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new file named urls.py in your app folder and add the code below.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.urls import path
from &amp;lt;your_app_name&amp;gt; import views

urlpatterns = [
    path('', views.index, name='home'),
    path('about/', views.about, name='about'),
    path('contact/', views.contact, name='contact'),
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have added three pages, index.html, about.html and contact.html, you can add more pages as required by your project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Again make sure to replace &lt;code&gt;&amp;lt;your_app_name&amp;gt;&lt;/code&gt; with your actual app name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating HTML pages
&lt;/h3&gt;

&lt;p&gt;Remember we created pages like base.html, index.html, about.html, contact.html in template folder, now we will ad html code to the pages.&lt;/p&gt;

&lt;h4&gt;
  
  
  base.html
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;{% block title %}{% endblock title %} - Django Setup&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

    &amp;lt;header&amp;gt;
        &amp;lt;!-- Navigation bar code goes here --&amp;gt;
    &amp;lt;/header&amp;gt;

    &amp;lt;main&amp;gt;
        {% block content %}{% endblock content %}
    &amp;lt;/main&amp;gt;

    &amp;lt;aside&amp;gt;
        &amp;lt;!-- Sidebar code goes here --&amp;gt;
    &amp;lt;/aside&amp;gt;

    &amp;lt;footer&amp;gt;
        &amp;lt;!-- Footer code goes here --&amp;gt;
    &amp;lt;/footer&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  index.html
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% extends 'base.html' %}
{% load static %}

{% block title %}Home{% endblock title %}

{% block content %}
&amp;lt;h1&amp;gt;Home page&amp;lt;/h1&amp;gt;
{% endblock content %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  about.html
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% extends 'base.html' %}
{% load static %}

{% block title %}About{% endblock title %}

{% block content %}
&amp;lt;h1&amp;gt;About page&amp;lt;/h1&amp;gt;
{% endblock content %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  contact.html
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% extends 'base.html' %}
{% load static %}

{% block title %}Contact{% endblock title %}

{% block content %}
&amp;lt;h1&amp;gt;Contact page&amp;lt;/h1&amp;gt;
{% endblock content %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating views function for each page
&lt;/h3&gt;

&lt;p&gt;Now we will create python functions for each page to render it in our browser.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In your app folder open views.py file and add the code below
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from django.shortcuts import render

# Home page
def index(request):
    return render(request, 'index.html', {})

# About page
def about(request):
    return render(request, 'about.html', {})

# Contact page
def contact(request):
    return render(request, 'contact.html', {})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Migrations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now we have to make migration, for that type the following code in your terminal one by one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7016sx52oy3ksfx3inak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7016sx52oy3ksfx3inak.png" alt="running-migrations" width="737" height="645"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;py manage.py makemigrations
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;py manage.py migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating super-user for the project
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a super user to access the project's dashboard using the command below, type it in your terminal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uztgbeew9dk1f427n6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0uztgbeew9dk1f427n6c.png" alt="creating-super-user" width="732" height="277"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python manage.py createsuperuser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will prompt you some things such as name, email, password. Input those appropriately and hit enter.&lt;/p&gt;

&lt;p&gt;Now we are all set. This is the simplest way to create and setup a django project. Now you can take this simple project further by adding more pages, urls, functions and so on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this post I tried to breakdown each set to setup a django project in the simplest way. I hope this will help you. Feel free to add your thoughts in the comment box if I missed something.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get my FREE eBook: &lt;a href="https://github.com/ashish-makes/django-setup/files/13924044/Professionally.setup.Django.project.pdf"&gt;A Comprehensive Guide to Setting Up Django Projects&lt;/a&gt;.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Starter Django Project: &lt;a href="https://github.com/ashish-makes/django-setup"&gt;Download the Starter Django Project.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/ashish-makes"&gt;https://github.com/ashish-makes&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Linkedin:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ashish-makes/"&gt;https://www.linkedin.com/in/ashish-makes/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Check out this Open Source Django-Tailwind Developer Portfolio and Blog in 2024!</title>
      <dc:creator>Ashish</dc:creator>
      <pubDate>Wed, 10 Jan 2024 22:44:46 +0000</pubDate>
      <link>https://forem.com/tinymce/check-out-this-open-source-django-tailwind-developer-portfolio-and-blog-in-2024-3p16</link>
      <guid>https://forem.com/tinymce/check-out-this-open-source-django-tailwind-developer-portfolio-and-blog-in-2024-3p16</guid>
      <description>&lt;p&gt;When exploring job opportunities, especially in technical fields like software engineering or web development, having a portfolio website is crucial. It serves as a centralized platform to showcase your work to the world.&lt;/p&gt;

&lt;p&gt;We're thrilled to present our latest open-source project, the &lt;strong&gt;"Django-Tailwind Blog."&lt;/strong&gt; Beyond being a traditional portfolio, it also functions as a blog where you can share your content with your community.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9wyldj31iml9owaqwzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9wyldj31iml9owaqwzh.png" alt="django-tailwind-blog" width="800" height="949"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Django Tailwind Blog
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"&lt;a href="https://github.com/ashish-makes/django-tailwind-blog" rel="noopener noreferrer"&gt;Django Tailwind Blog&lt;/a&gt;"&lt;/strong&gt; is a developer blog and portfolio website built using Django and Tailwind CSS. It includes several pages such as Home, About, Contact, Blog, Projects, Categories, and custom 404 pages. The project features a clean and modern design that is fully responsive and optimized for performance. It includes a powerful admin interface for managing the content, and is easy to customize and deploy to a production environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Technologies used
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Python (Django)&lt;/li&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;Tailwind CSS&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;TinyMCE WYSIWYG Editor&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Responsive design using Tailwind CSS&lt;/li&gt;
&lt;li&gt;Separate Blog and Projects page&lt;/li&gt;
&lt;li&gt;Admin dashboard for managing blog posts and portfolio items&lt;/li&gt;
&lt;li&gt;Contact form for sending messages to the site owner&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have used &lt;a href="https://www.tiny.cloud/" rel="noopener noreferrer"&gt;TinyMCE WYSIWYG&lt;/a&gt; editor to create the form to write articles which provides various options such as insert tables, images, link, comment, code. Furthermore it also provides various text formatting tools such as bold, italics, underline, various heading sizes, font styles and much more.&lt;/p&gt;

&lt;p&gt;Below are some project screenshots&lt;/p&gt;

&lt;h3&gt;
  
  
  About Page
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flf35fydkhvq3hr3xve9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flf35fydkhvq3hr3xve9q.png" alt="django-tailwind-blog" width="800" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Contact Page
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23d8qgz5b9p0ii6ojpji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23d8qgz5b9p0ii6ojpji.png" alt="django-tailwind-portfolio" width="800" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Custom 404 Page
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdw3b92evlgi4zrxjxbva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdw3b92evlgi4zrxjxbva.png" alt="django-tailwind-portfolio" width="800" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We hope you enjoy this project. Feel free to contribute and help make this open-source project even more awesome!&lt;/p&gt;

</description>
      <category>portfolio</category>
      <category>django</category>
      <category>python</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>How to Use ChatGPT4 for Free</title>
      <dc:creator>Ashish</dc:creator>
      <pubDate>Sun, 26 Mar 2023 13:12:16 +0000</pubDate>
      <link>https://forem.com/ashishmakes/how-to-use-chatgpt4-for-free-58en</link>
      <guid>https://forem.com/ashishmakes/how-to-use-chatgpt4-for-free-58en</guid>
      <description>&lt;p&gt;AI has taken over the internet. A new AI website is amazing people every week. One similar AI Language Model has broadened up the possibilities what AI can do and what we humans can achieve using the power of AI. I'm talking about &lt;strong&gt;GPT4&lt;/strong&gt;. Since the launch of Chat GPT, we have used it in our various tasks without any limitations as it was free. However GPT4 is only usable through paid subscription.&lt;/p&gt;

&lt;p&gt;This post will explain How to Use GPT4 for Free. Yes, you heard it right, you can use GPT4 for Free. I will mention two ways through which you can use GPT4 for Free.&lt;/p&gt;

&lt;h2&gt;
  
  
  GPT4 for Free
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The First Way
&lt;/h3&gt;

&lt;p&gt;The first way to use ChatGPT4 is Hugging Face. On huggingface.co there is a project where a users can char with a chatbot using chatgpt4 api. To use ChatGPT4 for Free you can follow the steps mentioned below.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visit this &lt;a href="https://huggingface.co/spaces/ysharma/ChatGPT4"&gt;ChatGPT4&lt;/a&gt; link on huggingface.&lt;/li&gt;
&lt;li&gt;Enter your prompt in input box and click on Run button.&lt;/li&gt;
&lt;li&gt;You can see the result from ChatGPT4 Bot in the Chatbot section.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it, with the above steps you can use ChatGPT4 without ChatGPT Plus subscription.&lt;/p&gt;

&lt;p&gt;One thing to note is that you will not always get result from chatbot because of excess usage by other people. However you can also duplicate the space and use Chatgpt4 by your Openai API key.&lt;br&gt;
The steps for the same is below.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create your Own ChatGPT4 Bot on HuggingFace
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3utvc0qovmoy3bkewklh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3utvc0qovmoy3bkewklh.png" alt="catgpt4-for-free" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visit the &lt;a href="https://huggingface.co/spaces/ysharma/ChatGPT4"&gt;ChatGPT4&lt;/a&gt; bot page on huggingface.&lt;/li&gt;
&lt;li&gt;Now click on &lt;strong&gt;Duplicate Space ( Duplicate the Space and run securely with your OpenAI API Key )&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Now change the visibility to &lt;strong&gt;public&lt;/strong&gt; and click &lt;strong&gt;Duplicate Button&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Now click on &lt;strong&gt;Settings&lt;/strong&gt; and scroll below to &lt;strong&gt;Repository secrets&lt;/strong&gt;, click on &lt;strong&gt;New secret&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add your &lt;code&gt;OPENAI_API_KEY&lt;/code&gt; in the field.&lt;/li&gt;
&lt;li&gt;Your ChatGPT4 Chatbot is ready to use for free, to use it click on App tab and start asking the questions to the bot.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Second Way
&lt;/h3&gt;

&lt;p&gt;Second way to use ChatGPT4 for Free is to use it on Poe website. This website provides one ChatGPT4 prompt for Free per day. You can use use it again by using different account for each prompt.&lt;br&gt;
To use ChatGPT4 for Free follow the steps below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fso09pjprlvp9pojatmu7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fso09pjprlvp9pojatmu7.png" alt="how-to-use-ChatGPT4-for-free" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Head over to Poe &lt;a href="https://poe.com/"&gt;ChatGPT4&lt;/a&gt; website.&lt;/li&gt;
&lt;li&gt;Now signup to create a new account.&lt;/li&gt;
&lt;li&gt;Once your account it ready, you have access to five AI chatbots including ChatGPT4 with limited access that is one usage per day. Other AI bots are Sage, Claude, Claude+, ChatGPT, GPT4, Dragonfly.&lt;/li&gt;
&lt;li&gt;Just click in GPT4 and use you one prompt.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is how you can use ChatGPT 4 for Free in 2023.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Currently these two websites allows us to Use ChatGPT 4 for Free, Although both of them have some disadvantages, however users can still experience the power of GPT4 for Free.&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Deploy Django Website for Free in 2023</title>
      <dc:creator>Ashish</dc:creator>
      <pubDate>Thu, 09 Mar 2023 06:21:08 +0000</pubDate>
      <link>https://forem.com/ashishmakes/how-to-deploy-django-website-for-free-in-2023-14d6</link>
      <guid>https://forem.com/ashishmakes/how-to-deploy-django-website-for-free-in-2023-14d6</guid>
      <description>&lt;p&gt;You created your Django website and now want to see it in action online? Don't worry, this post will explain in detail that &lt;strong&gt;How to Deploy Django Website for Free in 2023&lt;/strong&gt;. Although there are many websites available online to host django website for free, however this post will cover the website I use the most to deploy my django projects regularly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Knowing how to deploy websites online is one of the crucial skill to learn during your web development journey. Deploying a Django Website is important as it allows users to access the website. Without deployment the website remains confined to the developer's local machine and is of no use to others.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febd7mnecc8gq6z1z1cs1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febd7mnecc8gq6z1z1cs1.png" alt="deploy-django-website-for-free"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial I will share the steps to deploy your django website for free on &lt;strong&gt;&lt;a href="https://railway.app/" rel="noopener noreferrer"&gt;Railway&lt;/a&gt;&lt;/strong&gt; which is my favorite website to host django websites for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Railway?
&lt;/h2&gt;

&lt;p&gt;Railway is a cloud-based platform that allows you to set up infrastructure, develop your app using that infrastructure on your local machine, and then deploy your app to the cloud. Railway app makes it extremely easy to host your projects online by importing projects straight from GitHub. In addition, Railway provides fast hosting for users' projects online. &lt;strong&gt;Railway provides 500 hours of deployment each month for free in its Starter Plan which can be used to host your personal django projects.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Railway Features
&lt;/h2&gt;

&lt;p&gt;Railway provides various features such as Automagic Builds, Multiple Environments, Deployment Rollbacks and so on.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Automatic Builds&lt;/strong&gt;: Each time user pushes the code to GitHub, railway will automatically detect the changes and will build the project to deploy it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple Environments&lt;/strong&gt;: Users can easily evolve their app overtime with the help of with fork joinable environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment Rollbacks&lt;/strong&gt;: In case the change made to the app has a bug or the user don't like the change, for that case railway supports one-click, instant rollbacks for every change.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to Deploy Django Website for Free in 2023
&lt;/h2&gt;

&lt;p&gt;Moving forward to host django website for free on Railway, first you need a working django project. In case you do not have any, feel free to fork one from my &lt;a href="https://github.com/ashish-makes" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; repos.&lt;/p&gt;

&lt;p&gt;To Deploy Django Website for Free in 2023 follow the steps mentioned below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Firstly install a python library named gunicorn with the following command.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pip install gunicorn


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;In next step, once your project is ready to deploy, create a file named &lt;strong&gt;&lt;code&gt;Procfile&lt;/code&gt;&lt;/strong&gt; without any extension in the root directory of the project. Add the following code in the file.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

web: gunicorn project.wsgi


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Make sure to change &lt;strong&gt;&lt;code&gt;project.wsgi&lt;/code&gt;&lt;/strong&gt; to &lt;strong&gt;&lt;code&gt;yourprojectname.wsgi&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now create a file named &lt;strong&gt;&lt;code&gt;requirements.txt&lt;/code&gt;&lt;/strong&gt; which contains all the modules required for the project to run. In the root directory of the file run the following command using terminal.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pip freeze &amp;gt; requirements.txt


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The next step is to manage the static files during the production. To server static files during production we will use another python package named &lt;strong&gt;&lt;code&gt;whitenoise&lt;/code&gt;&lt;/strong&gt;. Install the latest version of the package using the command below.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pip install whitenoise


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Once the module is installed add the following middleware in the settings.py file just below the &lt;strong&gt;&lt;code&gt;django.middleware.security.SecurityMiddleware&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

MIDDLEWARE = [
    # ...
    "django.middleware.security.SecurityMiddleware",
    "whitenoise.middleware.WhiteNoiseMiddleware",
    # ...
]


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now add the following code in the settings.py file.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;This step will tell the django to serve the staticfiles in the production. Add the following code to the settings.py file.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

STATIC_URL = 'static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static")
]

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Once all the above steps are completed, run the command below.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

py manage.py collectstatic


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;This step finishes all the important steps required to Host Django Website for Free.&lt;/li&gt;
&lt;li&gt;Now commit all the changes and push the code to GitHub.&lt;/li&gt;
&lt;li&gt;Visit Railway website and click on &lt;strong&gt;Start a New Project&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the next page click in &lt;strong&gt;Deploy from GitHub repo&lt;/strong&gt; and login via GitHub account and give all the necessary permissions required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkgaguzdw0x1gbyhuiexk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkgaguzdw0x1gbyhuiexk.png" alt="host-django-website-for-free"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once its done, now you can see your project repo in the list, select the project and click on &lt;strong&gt;Deploy Now&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;After few seconds your Django Project will be hosted on the railway app for free. Now you can access the hosted django website from anywhere.&lt;/li&gt;
&lt;li&gt;Railway by default gives a long website URL which can be edited by settings section under domain option. Click in the edit icon and add any of your desired domain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6beo94lmn1trsh0b9kga.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6beo94lmn1trsh0b9kga.png" alt="deploy-django-website-for-free"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Railway is the quickest way to see your django project in action on the internet. I tried to explain the steps in detail to Deploy Django Website for Free. However, in case of any query feel free to comment your query below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LinkedIn&lt;/strong&gt;: &lt;a href="https://www.linkedin.com/in/ashish-makes/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/ashish-makes/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/ashish-makes/" rel="noopener noreferrer"&gt;https://github.com/ashish-makes/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Develop and Deploy Django Tailwind Blog and Developer Portfolio Website</title>
      <dc:creator>Ashish</dc:creator>
      <pubDate>Mon, 06 Mar 2023 12:01:51 +0000</pubDate>
      <link>https://forem.com/ashishmakes/how-to-develop-and-deploy-django-tailwind-css-developer-portfolio-website-2co1</link>
      <guid>https://forem.com/ashishmakes/how-to-develop-and-deploy-django-tailwind-css-developer-portfolio-website-2co1</guid>
      <description>&lt;p&gt;A portfolio website is must for any developer as it showcases the developer's projects and help him to organize his work at a place.&lt;/p&gt;

&lt;p&gt;I created an &lt;strong&gt;Developer Tailwind Portfolio Website&lt;/strong&gt; using Python's Django Framework, HTML, CSS and JavaScript. This website not only includes the section to showcase your projects but also has a dynamic blog page therefore its a Developer Portfolio  + Blog Website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp73rf73hob9dq6v004b9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp73rf73hob9dq6v004b9.png" alt="django-tailwind-css-portfolio"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  An Overview of Django Tailwind CSS Portfolio
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;"Django Tailwind Blog"&lt;/strong&gt; is a developer blog and portfolio website built using &lt;strong&gt;Django&lt;/strong&gt; and &lt;strong&gt;Tailwind CSS&lt;/strong&gt;. It includes several pages such as &lt;strong&gt;Home, About, Contact, Blog, Projects, Categories, and custom 404 pages&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The project features a clean and modern design that is fully responsive and optimized for performance. It includes a powerful admin interface for managing the content, and is easy to customize and deploy to a production environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technologies used
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Python (Django)&lt;/li&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;Tailwind CSS&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Pages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Home:&lt;/strong&gt; The landing page of the website, which displays a brief introduction and links to other pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;About:&lt;/strong&gt; A page that provides information about the site owner, their background, and skills.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contact:&lt;/strong&gt; A page that contains a contact form for visitors to send messages to the site owner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blog:&lt;/strong&gt; A page that displays a list of blog posts in reverse chronological order, with links to individual post pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blog Post:&lt;/strong&gt; A page that displays the content of a single blog post, including the title, author, date, and content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Projects:&lt;/strong&gt; A page that displays a list of portfolio projects, with links to individual project pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project:&lt;/strong&gt; A page that displays the details of a single portfolio project, including the title, description, date, and any relevant images or links.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Categories:&lt;/strong&gt; A page that displays a list of blog post categories, with links to filtered lists of posts for each category.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom 404 Pages:&lt;/strong&gt; Custom error pages that display when a user navigates to a non-existent page or encounters an error.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Website Admin Dashboard
&lt;/h2&gt;

&lt;p&gt;Using admin dashboard you can easily create, update and delete the blogposts. The admin dashboard uses WYSIWYG editor, TinyMCE to write your posts.&lt;/p&gt;

&lt;p&gt;More information about this project can be found on my &lt;strong&gt;&lt;a href="https://github.com/ashish-makes" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/strong&gt; Profile.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Link:&lt;/strong&gt; &lt;a href="https://github.com/ashish-makes/django-tailwind-blog" rel="noopener noreferrer"&gt;Django Tailwind CSS Portfolio&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/ashish-makes/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/ashish-makes/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/ashish-makes/" rel="noopener noreferrer"&gt;https://github.com/ashish-makes/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>webdev</category>
      <category>portfolio</category>
    </item>
  </channel>
</rss>
