I am trying to create a to-do app in Django by following this tutorial. However, things break after creating the ‘go back’ button at 46 minute mark. Clicking go back gives me the following error:
Using the URLconf defined in djangoProject4.urls, Django tried these URL patterns, in this order:
admin/
[name='tasks']
task/<int:pk>/ [name='task']
task-create/ [name='task-create']
The current path, task-create/“/”, didn’t match any of these.
The url is http://127.0.0.1:8000/task-create/“/”
. Which is weird because the code which is suppose to control this link is <a href = “{% url 'tasks' %}”> go back </a>
. Clearly this is redirecting to url named ‘tasks’. However it is redirecting to /task-create/"/"
.
If I change the task in <a href = “{% url 'tasks' %}”> go back </a>
to some absurd string. It says NoReverseMatch at /task-create/
and even the home page don’t load.
I am confused, from where is this task-create/"/"
coming from? It is certainly not coming from url template.
My template is in root project not the app. To account for that I have changed the settings.py
. I added "DIRS": [BASE_DIR / "templates"],
in Templates list.
My code can be found here.