MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Creating First Django App0%
Study Materials
Django for Backend DevelopmentProgress 0%
1.1Installing Django & Environment Setup1.2Django Project Structure1.3Creating First Django App
HomeTutorialsDjango for Backend DevelopmentCreating First Django App
Creating Models

Creating First Django App

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

In Django, features are organized into modular, decoupled applications. When you create an app, Django scaffolds a standardized directory structure containing models, views, tests, and admin configurations. Learning how to create, register, and wire an app into the URL routing pipeline is the primary workflow of Django development.


1. Scaffolding an App with startapp

To create a new app named articles:

1python manage.py startapp articles

Django generates the following files:

1articles/
2├── __init__.py
3├── admin.py # Registration of models with Django Admin dashboard
4├── apps.py # App configuration metadata
5├── migrations/ # Auto-generated database migration scripts
6│ └── __init__.py
7├── models.py # Data models and database schemas
8├── tests.py # Unit and integration test suites
9└── views.py # Request handling and HTTP response logic

2. Registering the App in INSTALLED_APPS

Django will not detect your app's models, migrations, or templates until it is registered in settings.py:

1# config/settings.py
2 
3INSTALLED_APPS = [
4 # Core apps...
5 "django.contrib.admin",
6 "django.contrib.auth",
7 "django.contrib.contenttypes",
8 "django.contrib.sessions",
9 "django.contrib.messages",
10 "django.contrib.staticfiles",
11 
12 # Custom Domain Apps
13 "articles.apps.ArticlesConfig", # Or simply 'articles'
14]

3. Writing Your First View (views.py)

A Django view is a Python callable (function or class) that takes an HttpRequest object and returns an HttpResponse object.

1# articles/views.py
2from django.http import HttpResponse, JsonResponse
3 
4def home_view(request):
5 return HttpResponse("<h1>Welcome to Enterprise Django Platform</h1>")
6 
7def health_check(request):
8 return JsonResponse({
9 "status": "healthy",
10 "service": "articles-api",
11 "version": "1.0.0"
12 })

4. App-Level URL Routing (articles/urls.py)

Create a dedicated urls.py inside the articles/ directory:

1# articles/urls.py
2from django.urls import path
3from . import views
4 
5# Application namespace for reverse URL resolution
6app_name = "articles"
7 
8urlpatterns = [
9 path("", views.home_view, name="home"),
10 path("health/", views.health_check, name="health-check"),
11]

5. Wiring App URLs to the Project Root

Connect the app's URLs to the root config/urls.py:

1# config/urls.py
2from django.contrib import admin
3from django.urls import path, include
4 
5urlpatterns = [
6 path("admin/", admin.site.urls),
7 path("articles/", include("articles.urls")),
8]

Now visiting http://127.0.0.1:8000/articles/health/ returns the JSON payload:

1{
2 "status": "healthy",
3 "service": "articles-api",
4 "version": "1.0.0"
5}

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What command scaffolds a new application module in a Django project?
Question 2
What happens if you forget to add a newly created app to INSTALLED_APPS in settings.py?
Question 3
What is the fundamental contract of a Django view function?
Question 4
What is the purpose of setting app_name = "articles" in an app's urls.py?
Question 5
In which file should you define database tables and entity schemas for an app?
Next Lesson

Creating Models

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Django Project StructureCreating Models

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Django for Backend Development with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext