6

I applied the fixes in the stackoverflow link:

<a href="{% url shop_index %}"><span>{% trans "Shop List" %}</span></a>

in urls.py:

url(r'^shop/$', 'index',  name="shop_index"),

But still the same error. Where am I wrong?

UPDATE:


Django 1.5

Python 2.7.2

{% url shop_index %} gives error. If I use {% url 'shop_index' %}, it is ok.


Django 1.5.dev17865

Python 2.7.3

{% url 'shop_index' %} gives error. If I use {% url shop_index %}, it is ok.


It is very strange.

Community
  • 1
  • 1
Burak
  • 5,706
  • 20
  • 70
  • 110
  • Which Django version do you use? – Tisho Jul 08 '12 at 14:04
  • Now I was trying in my cloud server. I deployed my project. Django versions are the same. But python versions are different. And in the server, it is giving same error. – Burak Jul 10 '12 at 09:38

1 Answers1

12

Try putting shop_index in quotes:

<a href="{% url 'shop_index' %}">

Without the quotations, shop_index will be treated like a template variable instead of a string.

Timmy O'Mahony
  • 53,000
  • 18
  • 155
  • 177