Creating Tech_projects urls and setting urls in the ebdjangoVR - SethuGopalan/ebdjangoVR GitHub Wiki

view functions are created, this need to hook them up to URLs. do that by creating a file Tech_projects/urls.py to hold the URL configuration for the app.

from django.urls import path

from . import views

urlpatterns = [

path("", views.Tech_project_index, name="Tech_project_index"), -connect the root URL of our app to the Tech_project_index view. 

path("<int:key>/", views.Tech_project_detail, name="Tech_project_detail"),- key value in the URL is the same key passed to the view function, so it 

                                                                          need to dynamically generate these URLs depending on which project  want to

                                                                         view. To do this, used the <int:key> notation. This just tells Django that 

                                                                          the value passed in the URL is an integer, and its variable name is key

]

Then now its need to connect these URLs up to the project URLs. In EBDJANGOVR/urls.py

from django.contrib import admin

from django.urls import path, include

urlpatterns = [

path("admin/", admin.site.urls),

path("Tech_projects/", include("Tech_projects.urls")),

]

⚠️ **GitHub.com Fallback** ⚠️