Include Other URLconfs

A snippet showing how to include URLs from other apps.


# models.py

from django.db import models

class Section(models.Model):
    name = models.CharField(max_length=50)
      

# admin.py

from django.contrib import admin
from .models import Section

@admin.register(Section)
class SectionAdmin(admin.ModelAdmin):
    list_display = ("name",)
      

# project/urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
  path("admin/", admin.site.urls),
  path("blog/", include("blog.urls")),
]

# blog/urls.py
from django.urls import path
from . import views
urlpatterns = [
  path("", views.index, name="blog-index"),
]
      
Explanation:
  • Use include() to delegate to an app's URLconf and keep project URLs tidy.
  • App URLconfs can be swapped or versioned independently.
  • Category URLs & Routing
  • Total Views 331
  • Last Modified 23 March, 2026
  • Tags #urls #include #apps #routing
Next snippet
Named URL Patterns
Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.