{"id":786,"date":"2013-07-01T00:00:00","date_gmt":"2013-07-01T00:00:00","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2013\/07\/01\/django-15-url-requires-a-non-empty-first-argument\/"},"modified":"2021-07-24T18:02:48","modified_gmt":"2021-07-24T18:02:48","slug":"django-15-url-requires-a-non-empty-first-argument","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Web-Development\/Django\/django-15-url-requires-a-non-empty-first-argument.html","title":{"rendered":"Django 1.5 – ‘url’ requires a non-empty first argument."},"content":{"rendered":"
When running Django 1.5.1 you may observe the following error,<\/p>\n
NoReverseMatch at \/<\/span><\/em> This issue can occur due to changes in the url tag syntax. More information on this can be found at https:\/\/docs.djangoproject.com\/en\/dev\/releases\/1.5\/<\/a>.<\/p>\n The correct syntax for url tags can be found below, as you can see the view is now enclosed within quotes.<\/p>\n In instances where you are upgrading to Django 1.5.1, rather then manually amend all of your old templates the following sed command can be used to update your templates.<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" Issue When running Django 1.5.1 you may observe the following error, NoReverseMatch at \/‘url’ requires a non-empty first argument. The syntax changed in Django 1.5, see the docs. Solution This issue can occur due to changes in the url tag syntax. More information on this can be found at https:\/\/docs.djangoproject.com\/en\/dev\/releases\/1.5\/. The correct syntax for url … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"yoast_head":"\n
‘url’ requires a non-empty first argument. The syntax changed in Django 1.5, see the docs.<\/span><\/em><\/p>\nSolution<\/strong><\/h2>\n
old - {% url project.app.views.main %}
new - {% url \"project.app.views.main\" %}<\/pre>\nsed -i -r 's\/url ([^\"]+) %\/url \"\\1\" %\/g' template.html<\/pre>\n