Answer the question
In order to leave comments, you need to log in
I have a version of django 2.1 and how do I know that in urls.py I need to write path instead of url?
I have django 2.1 and how do I know that in urls.py you need to write path instead of url, but the terminal cursed me for an error and then I changed it to urls and everything works. But why is that? But how do I know urls should be written in django 1 versions, but I have django 2 ? Here is my code (it works even though I have django 2 version)
from django.contrib import admin
from django.conf.urls import include, url
urlpatterns = [
url('admin/', admin.site.urls),
url('music/', include('music.urls')),
]
Answer the question
In order to leave comments, you need to log in
Starting with version 2.0, all the url handling stuff is stored in django.urls
, not django.conf.urls
like before. The old url()
one is available in this package, probably for compatibility.
More details in the release description (see the last paragraph)
Go to the main folder where settings.py is located, there is urls.py where the examples are written.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question