Django Frontend

Django

Django is a framework that can make web applications more accessible and faster. Django is an open-source collection of python libraries, and Django can be used for both the front and back end. The Django Software Foundation maintains the Django framework. The framework is mainly known for the pluggability of its components; that is, its components can fit into any web application. Django uses the reusability of its components method; it is also known as the DRY (Don’t  Repeat Yourself ). Django also provides read, delete and update interfaces which can be used during the runtime of the process and these can be used dynamically. Many websites use the Django framework to create their web applications; some of them include:

  • Instagram
  • Mozilla
  • Clubhouse
  • Nextdoor

Django first came into work in 2003, when two scientists, Adrian Holovaty and Simon Willison, used the python libraries to create the web application. The Django was named after Django Reinhardt, who was aguitarist. In the year 2008, the Django Software Foundation was established, which will now maintain all the properties of Django.

The Django follows the MVT ( Model View template ) design pattern:

Model: The model collects the data from the databases and provides it to the user. SQL is mainly used to extract the data from the databases, but to use SQL, we need to have a greater command of the database structure. In Django, the method the data is delivered to the user with a technique is known as Object Relational Mapping (ORM) technique which is designed mainly to make the work easier. The models are located in the file models.py

View: The view is a kind of function which takes the HTTP requests as an argument, and with this, it will import the required models for the process and returns the data to the template, and it will return the final result. The view is generally located in the file views.py

Template: The templates are generally used to present the final result of the web application. The templates generally use the .html language to design the webpage layout; we can also use the other standard file formats. The templates of the file are usually located in the folder templates.

Django Frontend

To run Django, first, we need to have python installed on our computer, and then we need to check whether the package manager pip is installed or not on our computer. To check them, we need to run the following commands

Command:

python  --version
pip --version

If the python and the pip are already present on your computer, it will return the versions of the python and the pip.

Output:

Python 3.9
pip  18.9.4 from c:\python32\lib\site-packages\pip (python 3.9)

To create a folder of our project and a virtual environment, we need to use the help ofvenv. It will create a virtual environment, and then it will create a  folder “project” with other subfolders like libraries, scripts

Command:

py  -m venv project

Output:

project
    Include
    Lib
pyvenv.cfg

Now we need to activate the virtual environment by using this command:

project\Scripts\activate.bat

Output:

(project)  C:\Users\Nihaas >

Now we need to install Django on our computer with the help of the python install package (pip), with the command:

(project) C:Users\Nihaas >py – m pip install Django

 We can also check the version of python with the help of the following command

(project)  C:\Users\Nihaas>django-admin – version

Output:

3.9.0

 We need to set the name of our project, and then we need to run the following command,

django-admin  startprojectstudentsmarks

Output:

studentsmarks
     manage.py
studentsmarks/
	_init_.py
	asgi.py
	settings.py
	urls.py

Now we need to run our Django packager to check for the working of our browser. We need to go to the /studentsmarks folder, and then we need to execute the command:

py manage.py runserver

Output:       

Watching for file changes with StateReloder
Performing system checks….
System check identified no issues
You have 23  unapplied migrations. Your project may not work properly until you apply migrations for the web application: admin, sessions, auth
Run ‘python.manage.py.migrate’ to apply them
August 31, 2022 – 18:13:22
Django version 3.9.0, using settings ‘students marks.Settings’
Starting development server at http://134.0.1.0:7900/
Quit the server with CTRL-BREAK.

We can find our web application by opening the URL in the new browser in google.


Related Topics

Django Forms

Django is a Python Programming Open Source framework for web development. It was released in 2008 and was developed by two web developers named Adrian Holovaty and Simon Willison. It...

3 minutes read.

Django Filters

Django is a high-level python based web framework. Django is mostly used as a backend engine for websites. Nowadays, every website communicates to a database to fetch all the information...

3 minutes read.

Life Cycle of Django

Life Cycle of Django Request - Response life cycle in Django  Thebasic principle of http protocol is the client sends a request to the server based on the request data, and the server sends...

3 minutes read.

Django Framework

Django is a popular high-level open-source web development Python framework based on follows Model View Template (MVT) architecture that allows rapid development. It. It provides common functionality like Admin Interface,...

3 minutes read.

Django CMS

Django is one of the most popular open-source Python web development framework. Developers use Django to build a website from scratch. Like WordPress, Django CMS is also a Content Management...

9 minutes read.

Django Frontend

Django Django is a framework that can make web applications more accessible and faster. Django is an open-source collection of python libraries, and Django can be used for both the front...

3 minutes read.

Best Django courses

In this tutorial, we will see various courses in python Django available on the internet. Django has become popular these days, so courses on it are also increasing day by...

7 minutes read.

Django Admin

To manage the content of the website, e.g., adding and deleting posts, web developers need an admin portal on the website. The admin portal allows trusted users, also knows as...

3 minutes read.

Django Model

Django Model A template is a class representing a table or collection in our DB and where each class attribute is a table or collection area. In the app / models.py, models are...

6 minutes read.

Django Project

Django Project Let's start to use it. Each web app you want to build in Django is called a project; and a project is a collection of apps. A software is a series of...

3 minutes read.

What is Django?

What is Django? Django is a free and open-source web application framework, written in Python. A web framework is a set of components that help you develop an easier and faster website. When we...

3 minutes read.

Django Image Upload

Django is a python based web framework that uses Model View Template as its architecture. Django provides really quick web development with its functionalities. While we are building a website,...

3 minutes read.

How to create an app in Django

Create an application in Django Django is famous for its unique and fully managed application structure. For each functionality, an application can be created as a completely independent module. This article will take...

2 minutes read.

Django MVT

 MVT(Model View Template) MVT means Model View Template is a software design pattern The View is used to implement the business logic and to communicate with a model for data transmission and to...

2 minutes read.

Django DRF

Django Rest Framework, which is also referred to as DRF, is a very powerful application to build RESTful APIs in a Django application. DRF uses the Django framework. Similar to...

3 minutes read.

Uses of Django

Django is a free and open-source Python-based web framework, which offers great functionalities to its users. Django was developed in 2003, and the final version was released in 2008 by...

3 minutes read.

Django and React

This article will discuss the overview of Django and React, their advantages, applications, and most importantly, how to implement react in Django. What is Django? Django is a free and open-source web...

6 minutes read.

Django Installation

Django Installation Django development environment consists of installing and setting up Python, Django, and a Database System since Django deals with a web application. Below the statement will guide you through installing Python 3.8.0 and...

2 minutes read.

Django vs Laravel

Django Overview Django is a Python Programming Open Source framework for web development. It was released in 2008 and was developed by two web developers named Adrian Holovaty and Simon Willison....

4 minutes read.

How to connect Django with Mysql

Any web application contains some data that comes from the input of the end-users. Thus, the database is required to handle those data. Several databases could be used to connect...

3 minutes read.