DEV Community

KABANGA David
KABANGA David

Posted on

Easy way to create a Django project in four steps

From this post, you will understand why Django is dubbed the framework for perfectionists with deadlines.
For some beginners who want to start their careers or start with web development using Django, it is not always easy, all these processes which burn the vision, which give goosebumps. But let me tell you that it's much easier than you think.
To be eligible to read this article, and to practice it, you will need to download and install python (https://www.python.org/downloads/release/python-392/) on your computer if you do not have it already installed.
Then check if it has been successfully installed by typing the following command in your windows PowerShell terminal:
python --v
If it gives you something like: python 3.x.x then congratulations 🎉
Actually, latest versions of python have pip (pip is a package manager used to install and manage packages written in Python.) included by default.

First Step: Create a virtual environment for your project. The goal of virtualenv is to prevent different versions of libraries/packages from messing with each other.
py -m venv env. Note that you have the option to choose how to name your env.
In the root of the folder, however, you will see an env folder created.

Second Step: Activate the virtual environment by typing this command in your terminal => Let's consider this is the structure of where you are working C:\projects\myproject>, then it should look like this: C:\projects\myprojects>env\Scripts\activate
If after this command, your terminal now looks like this: (env) C:\projects\myproject>, it just means your environment is ready.

Third Step: Install Django
We are going to use pip to install. It's so easy you can't imagine.
pip install django
Done ✔

Fourth Step: You can now use the django command to create your project which will contain all the applications you will create for the proper functioning of your project
django-admin startproject myproject_name
A manage.py file will be created, as well as a myproject_name folder. The myproject_name folder will contain 5 files including __init__.py, asgi.py, settings.py, urls.py and wsgi.py

That's all. Your Django project is ready! 😎

The next article will focus on creating an application as well as setting up a PostgreSQL database.

Top comments (0)