Skip to content
Advertisement

Why am i getting NoReserverMatch at /?

I am new to Python and trying to develop a simple blog application.I am getting NoReverseMatch at / error while trying canonical url. Tried different solution to fix this but i am getting help for django versions which are old. Please help me with a solution for updated Django version.

ERROR: Reverse for ‘post_details’ with arguments ‘(2020, ’08’, ’15’, ‘indian-software-industry’)’ not found. 1 pattern(s) tried: [‘blog/(?Pd{4})/(?Pd{2})/(?Pd{2})/(?P[-w]+)/$’]

This is my urls.py

JavaScript

This is my models.py (used for reverse url)

JavaScript

This is my post_list.html

JavaScript

Advertisement

Answer

This is old method to for routing a URL

JavaScript

In DJANGO 3.1 this method is used for routing a URL as i did below and it is understandable method

JavaScript

And you have to change your “Canonical URL” as i did below

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement