Forums

Project view templates cannot recognize app's namespace

My project's index page has an URL reference to my app's index like this <li><a href="{% url 'melbourne:index' %}"> A survey about Melbourne</a></li>

My project urls defined like this: url(r'^melbourne/', include('melbourne.urls', namespace='melbourne')), url(r'^admin/', include(admin.site.urls)), url(r'^$', views.index, name='index'),

The problem is the namespace in the project template 'melbourne:index' cannot be recognized, error: Caught NoReverseMatch while rendering: u"'melbourne" is not a registered namespace

My local machine django 1.5.4 works fine with the same code as pythonanywhere's. I doubt this is because pythonanywhere running old version django, isn't it?

It is. We have Django 1.3 by default. To use Django 1.5 at the moment, you need to use a virtualenv. There is a tutorial here