Loading, please wait...

A to Z Full Forms and Acronyms

Creating the First Project in DJANGO with Python

Jun 24, 2021 python django database, 1062 Views
here we will learn how to create a simple django project step by step

Creating the First Project in DJANGO with Python 

A Django application is  a collection of  application and configurations that when combined together will make  up  the full web application (your complete website running with Django ) 

firstly we will make a Django project then will we make a simple "hello world" application

Now before we make a Django project make sure you have to install Django on your system if not you can use following commands to install 

conda install django

 or you can use

pip install django

Note:-When you install Django it is also going to install a command-line tool called  Django-admin.

Django-admin is Django's command-line utility for administrative tasks. In addition, manage.py is automatically created in each Django project. It does the same thing as Django-admin but also sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project's settings.py file.

To check Django version you can use:-

 python -m django --version

now, you are all set and ready to go .. let's start our first Django project, to do so we will go to the directory where we want our project and  use this command 

Django-admin startproject project_name

here project_name is the name of your project, you can use whatever you want.

You will get something like this.. here 

  • __init_.py:- This is a blank python script that due to its special name lets python know that this is to be treated as a package
  • settings.py:- This is where you will store all your project settings
  • urls.py:-  this is a python script that will store all the  URL patterns for your project. basically the different web pages of your web application
  • wsgi.py:- this is a python Script that acts as a Web Server gateway interface. it will help us to deploy our web application to production 
  • asgi.py:- ASGI, or the Asynchronous Server Gateway Interface, is the specification which Channels and Daphne are built upon, designed to untie Channels apps from a specific application server and provide a common way to write application and middleware code.

ok.. let's go to next step where we will run our server,

python manage.py runserver

after running this code you will get something like this:-

now open your browser and type http://127.0.0.1:8000/ 

you will get something like this

Congratulation you have successfully created your first Django project

A to Z Full Forms and Acronyms

Related Article