Django logo

Getting started with Django

Django is an open source Python web framework that I started learning a few months ago. It took me a long time for the basics to click and I still find many of the concepts relating to developing websites using it challenging. This blog post and others that will come after it will be an attempt to document my learning and to make the concepts stick by putting them in writing.

Django is a third party application that does not come pre-installed with Python. The easiest way to install Django is to use the pip tool.

pip install Django

To check if the installation was successful, run the following command in a terminal:

django-admin version

That will display a version number if Django is installed and an error if Django was not installed successfully.

The next step is to create a project. A Django project is a collection of settings, database configuration and application specific settings for a Django instance.

To create a new project run:

django-admin startproject [project_name]

The startproject command creates a bunch of files and folders that have the following structure:
.
├── django_site
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

That details how to install and create a Django project. In the next article I’ll talk about how to make static web pages.