Say Hello to Django!

Django : A python-based free and open-source web framework that follows model-template-view architecture pattern. It encourages rapid development and pragmatic design.

Why Django?

Django is a much heavier weight web framework than Flask with a lot more out-of-the-box features that would’ve had to be built up manually and repetitively with a micro-framework like Flask.

Setting up for Django.

Assuming that you are already done with setting up your system with python and setting PYTHONPATH in Environment Variables Or you can simply follow the steps in this video.

Open Command prompt/ terminal, copy the below-given code, and hit Enter.

>>> pip install django

Creating First Project on Django

Django divides all of its web applications into ‘projects’, composed of different parts. To start a new project, open CMD/terminal on the working directory and copy the below-given code one line at a time.

>>> django-admin startproject projectName
>>> cd projectName
>>> python manage.py startapp appName

This will create a new project ‘projectName’ and an app ‘appName’ within the project.

Django creates a number of files with a new project:

__init__.py : Defines the directory projectname as a Python ‘package’, a collection of multiple Python files

Django is built on the idea of packages. A web application can be made up of multiple packages, each serving a slightly different purpose, and Django will help manage these.

manage.py : A Python script that can be used to perform useful operations on a web application

settings.py : Basic settings, like time zone, other applications installed in the project, what sort of database is used, etc.

urls.py : Determines what URLs/routes can be accessed when using the web application

wsgi.py : A file that helps to deploy an application to a web server

project_name/ : The directory for the project that contains all of the above files by default

A Django project consists of one or more Django applications, or apps, which serves a particular purpose.

This was an overview introduction to Django. In the next blog, we will be building our first Django-application. ‘Till then Happy Coding :]



Categories: Django, Python

Tags: , , , ,

1 reply

Trackbacks

  1. A Basic Application – Django – THE NUCLEAR GEEKS

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: