Start a Django project from scratch and print hello world

Spread the love

Django is a Python-based free and open-source web framework that follows the model–template–views architectural pattern. In this tutorial, I will show you how to start a new project in Django and print hello world.

Before jumping this tutorial, first, you have installed python and other stuff. Using this command python --version check you’ve to install python or not. After installing python, then you have to install pip. PIP is a package management system used to install and manage software packages written in Python. It stands for “preferred installer program” or “Pip Installs Packages.” PIP for Python is a utility to manage PyPI package installations from the command line.

python --version // Python 3.8.10

pip --version // pip 21.3.1 from /home/shahin/.local/share/virtualenvs/dg2-TOnqnzTa/lib/python3.8/site-packages/pip (python 3.8)

To ensure pip and python then you have to install pipenv. Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv , and the good old requirements. txt. In addition to addressing some common issues, it consolidates and simplifies the development process to a single command-line tool.

Read More : Implement selection sort algorithm using python

pip install pipenv

Well, after installing pipenv, create a folder for your project. Let’s have a look at the following commands and run them step by step. I assume you are in the desktop folder.

mkdir project // create a folder for project
cd project // go to project folder

Well, after reaching the project folder then run the following command.

pipenv install django

Using this command, you have to install Django in your project. After then you’ve to run this command. After successfully executing this command you can see two files in your project folder. One is pipfile another one is pipfile.lock

pipenv shell

Using this command you can make a virtual environment for your project. Well after then you have to create a Django project.

django-admin startproject project_name .

Using this command, you can create a project that is your root project. Inside this root project, you can see a couple of flies. Also, create another file that is

Well, after using this command, you can serve your project. Hit this following command, it will give you a development server link. Copy this link and paste your favorite browser.

python runserver hit this URL and get like this interface.

Hurry! you’ve successfully installed the Django project on your machine. Now you can create an app for your application. To create an app you have to run this command.

python startapp app_name

After creating an app, then you have to register the app name in your root’s file. You have to register INSTALLED_APPS list like this.

    'frontend' // your custom app

Hopefully, this tutorial will help you.

Learn Laravel

Spread the love

About Anisur Rahman Shahin

Hello. My name is Shahin. I'm a tech enthusiast guy. Personally, I’m an Optimistic and always in hurry kinda person. I'm a freelance web developer. I am working at Zakir Soft as Laravel Developer. My Portfolio website:

View all posts by Anisur Rahman Shahin →

Leave a Reply

Your email address will not be published.