Confusion with Path
Hey all, I understand that path should contain route, views, name and kwargs, however I am rather confused of each application. Currently learning from[https://docs.djangoproject.com/en/2.1/intro/tutorial01/#the-development-server](https://docs.djangoproject.com/en/2.1/intro/tutorial01/#the-development-server) and I will ignore kwargs for now. **Project: mysite | app: polls.**
#polls/urls
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
Q1: Why is the route ' '?
Q2: Where does the name='index' arrive from? I understand names are optional but they are especially useful for references, how will I utilize this?
#mysite/urls
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
Q3: Where do I grab the route from? And why is there a need for '/'?
Q4: "include('polls.urls'))" is a 'view' argument, is there no need to refer to a [view.py](https://view.py)?
Sorry for the long post, eager to get things right
/r/djangolearning
https://redd.it/9aq30n
Hey all, I understand that path should contain route, views, name and kwargs, however I am rather confused of each application. Currently learning from[https://docs.djangoproject.com/en/2.1/intro/tutorial01/#the-development-server](https://docs.djangoproject.com/en/2.1/intro/tutorial01/#the-development-server) and I will ignore kwargs for now. **Project: mysite | app: polls.**
#polls/urls
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
Q1: Why is the route ' '?
Q2: Where does the name='index' arrive from? I understand names are optional but they are especially useful for references, how will I utilize this?
#mysite/urls
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]
Q3: Where do I grab the route from? And why is there a need for '/'?
Q4: "include('polls.urls'))" is a 'view' argument, is there no need to refer to a [view.py](https://view.py)?
Sorry for the long post, eager to get things right
/r/djangolearning
https://redd.it/9aq30n