Getting Started

Summary: Django is a web application framework written in Python, made free and open source. It is widely used by developers to create web applications and high-level websites.

Hands on Django, the Complete Guide

Django is a web application framework written in Python, made free and open source. It is widely used by developers to create web applications and high-level websites. A single person could make it happen, thanks to a lot of features provided in its frameworks.

Using Django encourages the Developers to mainly focus on writing App, i.e. the logic part, all the other formalities either basic or advanced are handled by Django.

The several features and installation of Django will be covered in this post.

First thing first,

The Installation

Since it is a Python release, the main prerequisite is Python.

Database setup is also needed to start functioning of it.

For instance, Python within comes with SQLite a lighter version Database, if large data needs to be handled then must include a traditional database manager.

Install Django

When it comes to installation in terms of python one and only one tool comes in mind that is pip

pip install Django

In case if you want to install the development version, make sure Git is installed and run the following command

git clone https://github.com/django/django.git

Verifying it

>>> import django

>>> print(django.get_version())

2.2

Features of Django Framework

Django provides excellent documentation, making it easy for us all to learn it quicker. Here comes the list of featured specification of Django.

It has several layers to enable fast development

Visit here for detailed documentation: https://docs.djangoproject.com/en/2.2/

Model layer

A model is the single, definitive source of information about your data. It contains the essential fields and behaviors of the data you’re storing. This layer is provided for structuring and manipulating data of web application.

An example of a model in Django is

from django.db import models

class Person(models.Model):

   first_name = models.CharField(max_length=30)

   last_name = models.CharField(max_length=30)

View Layer

The concept of encapsulation and abstraction is held by the view layer of Django, it takes care of the “view” of the entity, i.e. the response to be returned to the user.

Template layer

The template is a designed form of a syntax provided here to show the necessary information according to the user, not by building from the scratch but manipulating the currently provided abstract.

The Admin Module

Django comes with the automatic admin interface, which works combinedly with model layer, i.e. taking metadata from the models.

The admin information is saved in modelAdmin interface this contains the code as

from django.contrib import admin

from myproject.myapp.models import Author

class AuthorAdmin(admin.ModelAdmin):

   pass

admin.site.register(Author, AuthorAdmin)

Thus python is a framework specially designed for faster development, directly concept to code, because of a lot of packages available inside it.

The most promising feature is a security concept here and the admin privileges, also it is scalable to an extent.

 


If you like it you can donate :)

share

Comments

Sign in to publish a comment

0 comments

Be the first to comment on this post.