Django: Your First Project and App

Harry · 14 Sep 2026 · 1 views
Advertisement
Advertisement

What is Django?

Django is a high-level, batteries-included web framework. It gives you an ORM, admin panel, authentication, routing, templates and forms out of the box.

Creating a Project

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

Open http://127.0.0.1:8000 to see the welcome page.

Creating an App

python manage.py startapp blog

Register the app by adding "blog" to INSTALLED_APPS in mysite/settings.py.

Define a Model

from django.db import models

class Post(models.Model):
    title = models.CharField(max_length=200)
    slug = models.SlugField(unique=True)
    body = models.TextField()
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title

Apply Migrations

python manage.py makemigrations
python manage.py migrate

Admin Panel

python manage.py createsuperuser
python manage.py runserver

Login at /admin and add your first post through the ready-made UI.

Key Points

  • A project is the whole site; an app is a reusable module inside it.
  • Models map to database tables; migrations keep the schema in sync.
  • Django's admin is generated automatically from your models.
Share this post:

Comments (0)

Please login or register to comment.