🚀 Django – Create Project Step-by-Step (2025 Beginner’s Guide)
🧲 Introduction – Why Start a Django Project?
Once you’ve installed Django, the first major step in web development is to create a Django project. A Django project acts as the root configuration and controller for one or more apps, managing settings, routing, and database connections.
🎯 In this guide, you’ll learn:
- What a Django project is
- How to create your first project using
django-admin
- Folder structure explained
- How to run your project and test it locally
🧰 Prerequisites
Before creating a project, ensure:
✅ Python 3.6+ is installed
✅ Django is installed (pip install django
)
✅ (Optional but recommended) You’re in a virtual environment
📁 Step 1: Choose a Directory & Activate Environment
Navigate to your desired location:
$ mkdir django_projects
$ cd django_projects
Activate your virtual environment:
$ source env/bin/activate # macOS/Linux
> env\Scripts\activate # Windows
⚙️ Step 2: Create a Django Project
Run the django-admin
command:
(env) $ django-admin startproject mysite
This will create a folder named mysite
with the following structure:
mysite/
├── manage.py
└── mysite/
├── __init__.py
├── settings.py
├── urls.py
├── asgi.py
└── wsgi.py
🔍 What Each File Does
File/Folder | Description |
---|---|
manage.py | Project CLI to runserver, migrate, shell, etc. |
mysite/ | Inner folder; actual project settings module |
settings.py | Configuration (apps, DB, static, etc.) |
urls.py | URL dispatcher for the project |
asgi.py /wsgi.py | Entry points for ASGI/WSGI servers |
🧪 Step 3: Run the Development Server
Move into the project directory:
$ cd mysite
Start the server:
$ python manage.py runserver
You’ll see something like:
Starting development server at http://127.0.0.1:8000/
Open your browser and go to: http://localhost:8000
✅ You should see the Django rocket welcome page!
📌 Summary – Recap & Next Steps
🔍 Key Takeaways:
django-admin startproject
creates the core project files- A Django project can host multiple apps
manage.py runserver
launches the dev server instantly
⚙️ Real-World Relevance:
The project structure ensures clean organization of settings, URLs, and app logic. It’s your launchpad for real-world web applications using Django.
❓ Frequently Asked Questions (FAQ)
❓ What’s the difference between a project and an app?
✅ A project is the main container with settings, DB config, and routing.
✅ An app is a module inside the project that performs a specific function (e.g., blog, store, user auth).
❓ Can I rename the project after creation?
🚫 It’s not recommended unless you update all references (especially in settings.py
, wsgi.py
, and manage.py
).
❓ How many apps can a Django project have?
✅ As many as you need. Django is designed to support multi-app architecture.
❓ Can I create multiple projects in the same environment?
✅ Yes, as long as each project is in a separate folder. Use different virtual environments for better isolation.
❓ Is it required to use django-admin
to start a project?
✅ It’s the official way to scaffold a new Django project quickly and correctly.
Share Now :