What is Django and how it works in python web development ?

Posted by

Introduction:

Django is a Python framework in which we can build a website. But before understanding the details of Django, it is important to know Python and basic frontend technology such as Html, CSS, javascript.

To say that it is a high-level framework means that it can be made a complex website by doing it. Why is it called a high level? Because it has many features,

Features:

Django Admin: In which you can administrate according to your project.

MVT(Model View Template)  Architecture:  Model View Template and Model View Controller are also called. Both of them are slightly different. Django has  MVT architecture because Django itself acts as a controller.

Model:  Model is a class where we keep our table and access our data.

View: it is a user interface in which we want to see how your website will be. Business logic has to be written accordingly.

Template: Django has its own template system, which can make a website in a good way.

Handling form: What is a Normally form? A form is a collection of elements in which <form> </form> we write.Form handling is a bit complicated, But Django handles well. Performs data rendering, Receive and perform the above-submitted data.

Session: Checks on a daily basis to store and receive arbitrary data. This is what the session does.

User management & Role-based permissions: Django has its own default configuration. It provides authentication and authorizations. For example, in a project, a superuser has to be created and the end-user is given authority.

ORM(object-relational Mapper):  The model has to interact with the help of ORM that means we have to write the queryset for accessing the database like SQL.

Proper Documentation: Django has a structural method of file and libraries, that’s why the document properly happens.

Testing Framework: Python has a builtin library that is untitest,  in which the test of Django takes place, and it does the layer-wise test

Django installation and How it works :

Before installing Django, we have to make sure that python and its associated libraries like pip should be present in the system.

See how to install it.

django version check

If you do not write the version, then it installs the latest one.

To check the version :

django install

Let us see how to create a project.

django project create

When the project creates, at that time some associate files also create.

Let’s Create an app for the project. To create an app, go inside the project folder.

There are two ways to create an app.

 

When an app creates, some associated files also create in it too.

So let’s see how the server  runs,

Put the URL(http://127.0.0.1:8000/) in the browser and check which is working or not.

 

 

Now we have set up Django installation and its test is also working well.

 

Leave a Reply

Your email address will not be published. Required fields are marked *