Django 1.5 - 'url' requires a non-empty first argument.


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.


This issue can occur due to changes in the url tag syntax. More information on this can be found at

The correct syntax for url tags can be found below, as you can see the view is now enclosed within quotes.

old - {% url %}
new - {% url "" %}

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.

sed -i -r 's/url ([^"]+) %/url "\1" %/g' template.html


Tags: Django

About the Author


R Donato

Rick Donato is the Founder and Chief Editor of He currently works as an SDN/NFV Solutions Architect and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001