← Back to Django Course | Chapter 1: Django Fundamentals & Setup | Lesson 6 of 9

Creating Your First Django Project

Starting a Django project is like Django building you an empty house with all the basic rooms already in place, ready for you to decorate.

Creating a New Project

Running "django-admin startproject mysite" generates a new folder named "mysite" containing the initial Django project files, ready to run.

Example: Creating a New Project

Scaffolds a new Django project named mysite with the default file structure.

bash
django-admin startproject mysite

⚠️ Run this command in your terminal.

Moving Into the Project Folder

After creation, you need to move into the outer project folder before running any other Django commands, since manage.py lives there.

Example: Moving Into the Project Folder

Changes into the newly created project directory.

bash
cd mysite

⚠️ Run this command in your terminal.

Listing the Generated Files

Running "ls" inside the project folder shows manage.py and an inner settings package, confirming the project scaffold was created correctly.

Example: Listing the Generated Files

Lists the files and folders generated by startproject.

bash
ls

⚠️ Run this command in your terminal.

What manage.py Does

manage.py is a command-line utility auto-generated with every project; it lets you run the server, apply migrations, and manage the app without typing long Python commands.

Example: What manage.py Does

Running manage.py help lists every subcommand it provides — runserver, migrate, createsuperuser, startapp, and more — confirming exactly what the file can do.

bash
python manage.py help

⚠️ Run this command in your terminal.

Common Mistakes
  1. Running "django-admin startproject" with a name that matches an existing folder, causing conflicts.
  2. Forgetting the trailing dot when creating a project inside the current directory, which creates an unwanted extra nested folder.
  3. Not activating the virtual environment before running startproject, installing files with the wrong interpreter tracked.
Chapter Summary
  • The "django-admin startproject" command scaffolds a new Django project.
  • A project contains a settings.py, urls.py, and a manage.py entry point.
  • manage.py is used to run project-specific commands like the dev server.
  • The generated folder structure is the starting point for every Django app.

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.