Django BasicsCore· 35 min read

Setting Up Django

Create a Django project and run the development server.

What you will learn

  • Install Django in a virtual environment
  • Create a project and app
  • Run the dev server

Install & create

Use a virtual environment (so packages stay per-project), install Django with pip, then create a project.

Terminal: install Django and start a project
python -m venv venv
# activate it:  Windows: venv\Scripts\activate   Mac/Linux: source venv/bin/activate
pip install django

django-admin startproject mysite
cd mysite
python manage.py runserver

Each line in order: python -m venv venv creates a fresh virtual environment (a private box for this project’s packages). The activate line switches your terminal into that box — the command differs on Windows vs Mac/Linux. pip install django downloads Django into it. django-admin startproject mysite generates the project files, cd mysite moves into the new folder, and python manage.py runserver starts Django’s built-in development server.

Note: Output: Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Open http://127.0.0.1:8000 in your browser — you’ll see Django’s welcome rocket. 🚀

Create an app

A Django project is split into apps (features). Create one with:

Create an app called blog
python manage.py startapp blog

Then add "blog" to INSTALLED_APPS in mysite/settings.py.

Tip: Key files: manage.py (commands), settings.py (config), urls.py (routes), and inside each app: views.py, models.py, templates/.

Q. Which command starts the Django development server?

Answer: python manage.py runserver starts Django’s built-in dev server (default port 8000).

✍️ Practice

  1. Create a virtual environment, install Django, and start a project.
  2. Create an app and add it to INSTALLED_APPS.

🏠 Homework

  1. Run the dev server and view the welcome page in your browser.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →