How to Create a Django Project and Application.

How to Create a Django Project and Application.

A guide to creating, testing and running a Django project and application in a local environment on both Windows and macOS.


This article is a guide on how to create your (first) Django project and application.

A Little about Django.

The web framework for perfectionists with deadlines.

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

Copied from the Django official website.

Interested in reading a little about Python, check out one of my articles The Language: Python.

Get started

Prerequisites and Requirements

Here are the prerequisites and requirements to get started in creating your Django application :

  • Install Python.

    Paste this command on your terminal. The command below is to verify if you have Python properly installed. It should provide the version of Python you installed.

      python --version
  • Install Django.

    The same thing applies to Django.

      django-admin --version

Create a Django Project.

I believe you have Python and Django installed. Navigate to the directory of your choice on your terminal, desktop is my choice of directory for my new Django project

cd desktop

and paste the command below to create your project, my_project is the name of my Django project.

django-admin startproject my_project

To check the files or folders in your project

#for MacOS
ls my_project

#for Windows
dir my_project

Create a Django Application

To create your Django application, copy and paste the command below on your terminal to change your directory to the newly created project.

#to change directory
cd my_project

#to create a django app
django-admin startapp my_app

Note: It is possible to have multiple applications based on the scope of the project.

Run and Test the Django Project

To check if our Django project is up and running, paste this code below on your terminal. The command is to run your server(app/project) locally.

python runserver

If the image below is the same as yours, then you have successfully created your Django project/ application.

The warning about unapplied migrations is related to the database, which will not be covered.

cmd image

To view the locally hosted project on your browser, click this link This is the local server link to your Django application, and this should be the view of your project on the browser.

localhost hosted website

Congratulations on creating your (first) Django application.