[Answered ]-Reverse for 'new_project' with arguments '('',)' not found. 1 pattern(s) tried: ['new_project/$']

0👍

Template tags within html comments still get rendered by the template engine. To demonstrate:

from django import template

t = template.Template("""
<!-- {% url 'test' %} -->
""")

t.render(template.Context())

This will return:

NoReverseMatch: Reverse for ‘test’ not found. ‘test’ is not a valid view function or pattern name.

Even though the template tag url is enclosed with an html comment, it still raises an error if there is no url named test.

1👍

Thanks, Marcel h and BrianD, I found the answer, it turned out that it is the comment that caused the issue, even though I have made it as a comment, it still caused the problem, my solution is to delete that comment.

Leave a comment