Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

django
communitycreator

How to create a Django project

Onyejiaku Theophilus Chidalu

Overview

A Django project comes in handy when developing a website using the Django framework.

The Django framework is essentially a library of reusable modules. It helps to define a structure for our applications by telling us what folders and files we should have in our project. This provides a consistency among various Django projects.

Creating a Django project

Using Pycharm as our IDE, the various steps to take when creating a Django project are illustrated below.

Step 1: Create a folder

Open the Pycharm IDE. Click on the Create New Project option.

widget

Step 2: Name your folder

Name your folder and give it a location. Here, let’s name our folder Edpresso.

/users/Theophilus/MyDjangoproject/Edpresso

Step 3: Install Django

Now, down at the bottom of the Pycharm window, open a terminal window as seen in the image below. Type the following command:

Edpresso pip install django

With the command above, we tell pip to help us install Django.

widget

Step 4: Create the project

Use the Ctrl and L keys to clear and create a new terminal window. Next, create and name the project (let’s name our project shots) using the following command:

django-admin start project shots .

When we installed Django, it brought a command line utility called django-admin. This is a utility program we can execute from the terminal.

django-admin takes various arguments, and in this case we used the argument startproject and with it, we are creating a project called shots.

The period . in the command is very important, as it lets Django know that the project we just created should be in the current folder Edpresso. If you don’t add the period, the Django utility will create an extra folder.

To be sure you have successfully created a new project, go to your Pycharm and click on the "Edpresso" folder. Inside this folder is the "shots" model, which must contain different folders such as: __init__py, settings.py, urls.py, wsgi.py.

RELATED TAGS

django
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu
RELATED COURSES

View all Courses

Keep Exploring