Start your first Django Project

Start your first Django Project

Putting your first steps into realm of Django by creating Django projects with clean architecture

Table of contents

In the realm of web development, Django emerges as a standout framework, seamlessly combining simplicity with power. Named after the legendary jazz guitarist Django Reinhardt, this Python-based framework is a go-to choice for developers aiming to build scalable and maintainable web applications.

In this blog post, we embark on a journey into how to setup project professionally

  1. Let's start from creating a new folder for Django Project
mkdir bookshop # Create a new folder
cd bookshop # Change directory
  1. Now we can create and activate a virtual environment
python -m venv .venv # This command creates a virtual environment folder
.venv\Scripts\activate  # Activate the virtual environment (For Windows Users)
  1. Now after creating and activating our virtual environment we can install dependencies
pip install Django # Installing Django

After successfully installing Django we need to add it into our requirements.txt by typing the following command in Terminal:

pip freeze > requirements.txt

With the completion of our Development Environment setup, it's time to initiate the project setup process. Within the designated project folder, we're poised to establish a well-organized and architecturally clean project structure. To commence this endeavor, we can follow the outlined steps below:

django-admin startproject config .

You can see the project folder as represented below:

|__ config
    |__ __init__.py
    |__ settings.py # Main management file
    |__ wsgi.py
    |__ asgi.py
    |__ urls.py # Module which maps the url
|__ manage.py

We can now start our development server:

python manage.py runserver

As we conclude this post, armed with a configured development environment and a solid project setup, we are well-equipped to delve deeper into the capabilities of Django. The journey ahead promises exciting discoveries and the creation of web applications that embody both elegance and functionality. Stay tuned for more insights and practical tips as we navigate the vast landscape of Django development.

Happy coding!!!