efuzz
efuzz

Reputation: 117

What is the difference between these two paths in urlpatterns?

urlpatterns = [
    path('admin/', admin.site.urls),
    path('job', jobs.views.home, name='home'),
    path('job/', include('jobs.urls')),
]

What is the difference between the two paths? When should I use jobs.views.home and when should I use the include()

Upvotes: 0

Views: 75

Answers (1)

Vira Lok Virus
Vira Lok Virus

Reputation: 31

I'm a new django-user so i will try to answer maybe i'm wrong.

path('job', jobs.views.home, name='home')

will call the home function that you defined in views.py file of the API jobs

path('job/', include('jobs.urls))

will include the file urls.py in your job API.

In your urls.py , you should have path('', jobs.views.home, name='home') to call the home function of your views.py file

Upvotes: 3

Related Questions