100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Python

Creating a Django Project

A practical walkthrough of scaffolding a new Django project with django-admin, understanding the generated files, and running the development server for the first time.

Django FoundationsBeginner8 min readJul 10, 2026
Analogies

Creating a Django Project

A Django project is created with a single command, django-admin startproject mysite, which generates a directory containing manage.py and an inner package also named mysite holding four key files: settings.py, urls.py, wsgi.py, and asgi.py. This one command scaffolds the entire skeleton a Django site needs before a single line of application code is written, which is why it's the very first step in any Django tutorial and any real production project alike.

🏏

Cricket analogy: Similar to how groundstaff prepare a pitch, boundary rope, and sightscreens before a single ball is bowled at a venue like the MCG, django-admin startproject prepares settings.py, urls.py, and manage.py before a single line of application code is written.

Understanding the Generated Files

manage.py is a command-line utility used for administrative tasks like runserver, migrate, and startapp, and it works by setting the DJANGO_SETTINGS_MODULE environment variable before delegating to Django's internal command-line tooling. settings.py centralizes configuration, including INSTALLED_APPS (which apps are active), DATABASES (connection details, SQLite by default), MIDDLEWARE (a list of hooks that process every request/response), and ALLOWED_HOSTS (which domains may serve the site) — a value that must be set correctly in production or Django will reject incoming requests with a 400 error.

🏏

Cricket analogy: Similar to how the match referee's rulebook lists every regulation governing a fixture, settings.py lists every configuration a Django project needs — INSTALLED_APPS, DATABASES, ALLOWED_HOSTS — in one central file.

Running the Development Server

python manage.py runserver starts Django's lightweight built-in web server, typically listening on http://127.0.0.1:8000/, and is intended purely for local development — it is single-threaded by default, has no production-grade security hardening, and Django's own documentation explicitly warns against using it in production. Visiting the URL immediately after startproject shows Django's default 'The install worked successfully' congratulations page, confirming settings.py is valid and the WSGI application can be served, before any app-specific views have been added.

🏏

Cricket analogy: Similar to a warm-up net session before an actual match at a venue like Eden Gardens, runserver is meant purely for local development — Django's docs explicitly warn against using it as the 'match-day' production server.

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

# Visit http://127.0.0.1:8000/ to see Django's success page

# Generated structure:
# mysite/
#   manage.py
#   mysite/
#     __init__.py
#     settings.py
#     urls.py
#     wsgi.py
#     asgi.py

Never run runserver to serve real production traffic. It is single-threaded, lacks production security hardening, and Django's documentation explicitly recommends a WSGI/ASGI server like Gunicorn or Daphne behind Nginx for production deployments.

  • django-admin startproject mysite scaffolds a new Django project skeleton.
  • manage.py is the command-line utility for admin tasks like migrate and runserver.
  • settings.py centralizes INSTALLED_APPS, DATABASES, MIDDLEWARE, and ALLOWED_HOSTS.
  • urls.py is the project-level URL configuration entry point.
  • python manage.py runserver starts a local-only development server on port 8000.
  • The default database backend is SQLite unless DATABASES is reconfigured.
  • runserver must never be used in production; use Gunicorn or Daphne instead.

Practice what you learned

Was this page helpful?

Topics covered

#Python#DjangoStudyNotes#WebDevelopment#CreatingADjangoProject#Creating#Django#Project#Generated#StudyNotes#SkillVeris