DEV Community

Cover image for How to Set Up a Django Project Structure Using VS Code
Hannah
Hannah

Posted on

How to Set Up a Django Project Structure Using VS Code

If you're just getting started with Django and want to build your project using Visual Studio Code (VS Code), you're in the right place. In this guide, I’ll walk you through setting up a clean Django project structure from scratch using VS Code — perfect for beginners and those who want a solid foundation for scalable web apps.
Before l dive in, make sure you have the following installed:

  1. Python (3.13 or higher).

2.pip.

3.virtualenv.

📁 Step 1: Create Your Project Folder.
Open VS Code and create a new folder;

`mkdir my_django_project cd my_django_project 
Enter fullscreen mode Exit fullscreen mode

`

after the creating this how they will look like;
Image description

Image description

🧪Step 2: Set Up a Virtual Environment
Virtual environments are essential in Python development—especially for Django projects. Each Python project might require different versions of packages. A virtual environment keeps dependencies isolated so that one project’s requirements don’t interfere with another’s.
we need to Create and activate a virtual environment;

`

python -m venv env # On Windows env\Scripts\activate # On macOS/Linux source env/bin/activate 
Enter fullscreen mode Exit fullscreen mode

`

Image description

Image description

📦Step 3: Install Django.
Once your virtual environment is activated, the next step is to install Django — the powerful web framework that will power your project.
Install Django using pip;



pip install django

Image description

After install it look like this;

Image description

then after that run the server



python manage.py runserver

then it click the link and it brings success of install of django

Image description

🚀Step 4: Start a New Django Project

Now create your Django project

Image description

use the command;

`

`django-admin startproject <project_name>` 
Enter fullscreen mode Exit fullscreen mode


Your folder structure should now look like this:

my_django_project/ ├── config/ │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py └── env/ 
Enter fullscreen mode Exit fullscreen mode

`

Step 5: Create a Django App

Installed the required django apps l used command to create the apps which they were two apps;

Image description

Now your structure will look like this ;

Image description

but for the second app this how structure will look like;

Image description

🧱Step 6:Creating Models

Each app will have its own views and templates. Here’s how to link them and display two templates from each.



`blog/
└── templates/
└── blog/
├── home.html
└── about.html

portfolio/
└── templates/
└── portfolio/
├── home.html
└── projects.html
``

`

Image description

🌐Step 7: Set Up URLs

In Django, URLs are how you connect your web browser to specific views in your app. Think of them as the road signs that tell Django which view to display when someone visits a certain page.
this how it look like;

Image description

Image description

Step 8: Set Up html

In Django, HTML is used to build the templates that define how your web pages look. These templates are combined with data from your views to create dynamic, interactive websites.

l added them this how it look liked;

Image description

✅ Final Result

Now you can run the project and see how it look;

run using;


python manage.py runserver

this how it will look like;

Image description

In this guide, we walked through the full process of setting up a Django project using Visual Studio Code. Here's a quick recap of what we covered:

✅ Creating a virtual environment to isolate dependencies

✅ Installing Django and verifying the installation

✅ Starting a new Django project and creating multiple apps

✅ Setting up views, templates, and URL routing for each app

✅ Understanding how HTML works within Django templates

Django is incredibly powerful once you get the hang of it—and the best way to learn is by building.

Got questions, stuck somewhere, or want to share what you built? Drop a comment below—I’d love to hear from you and help out!

happy coding

Top comments (0)