Q:

Using a name for dummy url patterns in django

I have a project with an app named exams. Right now my index page is the index page of one of these apps. So the url patterns is something like this:
from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^', include('exams.urls', namespace="exams")),
)

However it is possible that in future I want to create a new view for my index page and change the url patterns to something like this:
from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^exams/', include('exams.urls', namespace="exams")),
    url(r'^/$', 'mysite.views.index', name="index"),
)

I want to create some links in my template to index whether it loads the exams app or another view. So I tried to use the name argument for the url method(like above) but it seems it's not working. When I use {% url 'index' %} in my template it returns the following error:
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

UPD: I forgot to mention that I tried using the following code:
from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^', include('exams.urls', namespace="exams"), name="index"),
)

And I got the error I wrote above.
UPD2: To clarify the problem more:
Right now when I go to http://mydomain/ I'll see my app index. But maybe in the future I like to change my index page and use another view for creating it. So when I go to http://mydomain/ I'll see the page rendered by that view and by going to http://mydomain/exams I'll see my apps index pages. In that case my urls.py will be sth like the second code I wrote above in which I can easily link to index page using {% url 'index' %} tag. However for now I'm using the code I wrote in my first update. I want my templates to render {% url 'index' %} as a link to my index page(instead of using {% url 'exams:index' %} so when I later change the urls.py code I won't have to change all of my templates.

A:

If I understand well, you want an index view that could be easily changed, while not changing the links pointing to it in your templates. You can use your index view as a wrapper for other views ie:
def a_view_that_will_show_all_the_exams(request):
    # this is the page displayed for now as default, but this could change
    # some logic here

def another_view_that_could_become_the_home_page(request):
    # some logic here

def index(request):
    return a_view_that_will_show_all_the_exams(request)
    # or another_view_that_could_become_the_home_page
    # or return exams.views.whatever_view

This way you can easily change the result of the index view while keeping your links static.

