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.
Using Pycharm as our IDE, the various steps to take when creating a Django project are illustrated below.
Open the Pycharm IDE. Click on the Create New Project option.
Name your folder and give it a location. Here, let’s name our folder
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.
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
. 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.
View all Courses