If you come across the word Django and thinking about “what is Django?” then here we will first understand and then demonstrate a simple beginner’s project using Django.
Django is a full-stack web framework written in Python. A full stack web framework handles a bunch of different components that are typical when creating a web app. It contains library that helps in handling each of the pieces
-writing your application code
-storing and retrieving data
-receiving and responding web requests
If you want to build an application that has a web frontend, using a web framework like Django can save a lot of time and effort because all libraries are handy to use and it helps in simplifying the much complicated work.
Web framework are commonly split into three basic components that are
– application code – here you will add all of your application logic
– data storage – what data you want to store and how you are storing it
– web server – here you will stage which pages are served by which logic
splitting your code like that helps you write your code in much simplified format, promotes code reuse and allow all flexibility when accessing data.
Let’s understand this with a simple example:
You have a simple web page where users can access the information already stored in it, and a separate programmatic interface that can be used by other applications or scripts to transmit data to the system.
There is a simple project using Django for beginners you can take a look at https://github.com/keshavgbpecdelhi/my_first_django_project/. Here I have explained step by step literally very basic Django startup settings to show up your message in localhost.
When you are writing a web application, there will be some critical and small decisions to make. Relying on a framework like Django is similar to use external libraries for your code. There are lot of features in Django which you can use easily instead of writing everything from scratch and re-making all the common/silly mistakes that we make when writing web application for the first time.
Django has a bundle of useful components for building websites. For an instance you can understand its implementation like you are using Django in your company’s websites, there you can interact with it form your terminal. It does this by taking the request for a URL and parsing it from one of its core module. This allows you to serve different pages depending on what URL is being requested. You can even built complex logic into the function handling the request to make more interactive pages.
Django can also handle reading and writing data from a database, letting you store and retrieve data used by your application. Django makes it easy to interact with data stored in database by using an Object Relational Mapper (ORM). This tool provides an easy mapping between data models defined as Python classes and an underlying database that stores the data.
In fact there are many handy tools as per your exploration you can get them all 🙂 But remember Django is not only one full-stack web framework available there are lot many in market. As Django is one of the many popular frameworks, alternative python based web framework similar to Django include CubicWeb, CherryPy, Bottle and Flask. There are lots of other frameworks written in other languages too, not just Python.