patients/urls.py
      
from django.urls import path
from . import views


app_name = 'patients'


urlpatterns = [
    path('', views.index, name='index'),
]
      
    

The actual URL pattern is a call to the path() function, which takes three arguments:

  1. The first argument is a string that helps Django route the current request properly. Django receives the requested URL and tries to route the request to a view. It does this by searching all the URL patterns we’ve defined to find one that matches the current request. Django ignores the base URL for the project (http://localhost:8000/), so the empty string ('') matches the base URL.

  2. The second argument in path() z specifies which function to call in views.py. When a requested URL matches the pattern we’re defining, Django calls the index() function from views.py

  3. The third argument provides the name index for this URL pattern so we can refer to it in other code sections. Whenever we want to provide a link to the home page, we’ll use this name instead of writing out a URL.
  1.  Copied

  2.  Copied

patients/models.py
      
from django.contrib import admin

from .models import Patient, Symptom

admin.site.register(Patient)
admin.site.register(Symptom)