Part 2 - Setting up a Django Project
Setting up a Django Project – Getting Started Guide

If you’re beginning your journey with Django, this guide will walk you through the essential steps to set up your first project.
From activating a virtual environment to running your server locally.



 

Activating your virtual environment
If you haven’t created a virtual environment yet, refer to the previous post: Creating a Virtual Environment with Miniconda

activate myfirstenv


Installing Django 

pip install Django

 

Creating a Django project

django-admin startproject mysite

 

Creating a Django app
Django apps help keep your code organized into modular and reusable sections.

cd mysite
python manage.py startapp news

 

settings.py
Newly created apps must be included in the INSTALLED_APPS list.

INSTALLED_APPS = [
    ...
    'news',
]


Migrations
This command applies Django’s initial database migrations (authentication, admin, sessions, etc.), setting up the default database schema.

python manage.py migrate

 
Super User
Superusers have full access to the Django Admin Panel.

python manage.py createsuperuser

 
Running the server locally

python manage.py runserver

 

Access through the browser
Root: http://localhost:8000/
Admin: http://localhost:8000/admin
 


Tested with Django 5.2



08 Sept. 2022 | Last Updated: 19 Dec. 2025 | jaimedcsilva

Related
  • Part 1 - Virtual Environment
  • Part 2 - Setting up a Django Project
  • Part 3 - Templates, Views and URLs
  • Part 4 - Static and Media Files
  • Part 5 - Models and Database
  • Part 6 - Connecting everything
  • Part 7 - Publishing to the internet

  • Buy Me a Coffee