Hello, I’m currently working through the Learn Web Development course and I have two questions. First I hope I’m in the right place and second this is a great course and I give kudos to those who developed the course. Both questions are in regard to the server-side website programming section -> django -> Part 5: creating our home page.
My first question is: I get a warning when I run the server. The warning is:
?: (urls.W002) Your URL pattern ‘/’ has a route beginning with a ‘/’. Remove thi
s slash as it is unnecessary. If this pattern is targeted in an include(), ensur
e the include() pattern has a trailing ‘/’.
This warning is in reference to the /locallibrary/urls.py file, specifically this line of code:
urlpatterns += [
path(’/’, RedirectView.as_view(url=’/catalog/’, permanent=True)),
If I comment out this line the warning goes away. If I ignore the warning everything seems to still work anyway. Is there something wrong with the tutorial or is this normal?
My second question is: At the end of this section you are supposed to load the home page using http://127.0.0.1:8000 and you are supposed to be redirected to http://127.0.0.1:8000/catalog which shows the books library home page. This is not what actually happens. When I load http://127.0.0.1:8000 I get a 404 error. However if I append /catalog then I get the books library home page. So my question is: is the tutorial incorrect or is this the expected behavior?
I hope my questions are clear enough to understand and I appreciate any feedback. And if I’m asking this question in the wrong place then please just let me know and I’ll redirect to the correct place.
Thank you very much for your help.