Project urls
The project urls.py
list routes URLs to views.
# urls.py
from django.contrib import admin
from django.urls import path, include
from expression import views
urlpatterns = [
path('', views.home, name='home'),
path('admin/', admin.site.urls),
path('expression/', include('expression.urls'))
]
Description
from django.contrib import admin This imports the Django admin module to create the interfance for managing application's data.
urlpatterns[]
List of all the URL patterns for Django application, i.e. isoforms.com
, isoforms.com\admin
, isoforms.com\expression
path('expression/', include('expression.urls'))
Includes additional URL patterns from the expression.urls module (listed in the expression\urls.py
)
NOTE: Important to update the urlpatterns everytime a new module/sub-folder is added.
Adding new module
If adding a new module called Structure
, the new urls.py
would be:
# urls.py
from django.contrib import admin
from django.urls import path, include
from expression import views
urlpatterns = [
path('', views.home, name='home'),
path('admin/', admin.site.urls),
path('expression/', include('expression.urls')),
path('structure/', include('structure.urls'))
]