Django Website Tutorial: Creating a Django Project From Scratch

Django Website Tutorial: Creating a Django Project From Scratch

Django Website Tutorial – all the basics, getting started and all you need to know, even as a beginner.

Django is an open-source web framework that runs on python. It was initially released in 2005 as a framework to simplify web application development. It has since grown to be one of the best and most widely used python web development frameworks.

django website tutorial
django website tutorial

In very simple terms – Django is like a collection of common code required when developing a web apps. It assists regular developers to write web apps in a fraction of the time, by eliminating the need to re-write common boilerplate coding like “database management code”.

Django is like a shortcut to web development, handling the heavy-lifting so developers can focus on the specifics of the app.

Who else is using Django?

create django website
create django website

As one of the most popular python web development frameworks. Django is powering quite a number of popular web applications.

  • Instagram
  • Spotify
  • Youtube
  • Quora
  • Washington Post
  • Dropbox
  • NASA

Just to mention a few.

Django versus Flask Framework – Python

I must mention, there are many web development frameworks in Python. Here is a list of some of the most common:

  • Flask
  • AIOHTTP
  • Pyramid
  • Web2Py
  • Dash
  • CubicWeb
  • Bottle
  • Tornado
  • CherryPy

And the list goes on and on – however, of all these platforms, the most common are Flask and Django. They are however very different, and what you choose should be based on the specific requirements of the project at hand.

Flask Web Framework

Flask is a micro-framework that us lighweight and almost bare-bones. It does not come with the majority of add-ons and features you will find in Django. It is easy to implement a simple web-app in just a few lines of code using Flask.

Check out our Python Flask Web Application article for more information on flask.

All the add-ons you will require in Flask, you must implement on your own. It allows for flexibility of coding as a trade-off for faster web development. You can implement any type of database, routing etc that you wish with Flask.

Django Website Tutorial

django tutorial
django tutorial

Getting started with Python Django Website Tutorial

As a web developer, learning python Django is probably one of the best skills you can develop.

Python Django is one of easiest frameworks to work with, there are a few concepts that one must understand before getting started:

Object Oriented Programming

Object oriented programming is a type of programming or coding, where the programmer organises the code around data objects. The opposite of which would be Function Oriented Programming.

In simple terms, you need to think of data sets or classes. For example, take a Car as an Object/Class. A car is a high level object, it will have multiple features that can be used to describe different types of cars. These features is how one would differentiate one car from the other.

For example, these features can be:

  • Colour
  • Make
  • Model
  • Vin Number

The list of features can go on, it all depends on the purpose of creating the class. So one one would have a separate sets of features from the next. However some features can be the same – eg. colour. In a dataset, you require one unique feature that can never be replicated – eg. Vin Number.

A set of car features, which represent one car is called an instance in programming. We create the class, then use the instances to describe various versions of the class.

This is very important because it helps us to do the following:

  • To be able to enter the data in to a database in a structured format
  • Search our database for specific instances
  • Pull up common themes eg. “red cars” from our dataset
  • etc.

Object Oriented Programming is at the core of Django, everything else expands from there.

Views

Views are code that is written to display to the front end, any data – html code that is required by the app.

Models

Models are used to describe our classes and objects that we use in the web application

Templates

These are html files that get rendered by the views. The view connects to the models to pull out the data, and display it to the client through templates.

Django is simple, but there are very specific approached to developing an application. Check out this Django Web Development Masterclass – lecture series on creating a web application with Python Django

Leave a Reply

Your email address will not be published.

Subscribe to our mailing list

And get this 💃💃 Free😀 eBook !

Holler Box