title: Django render redirect to page with changing url
body: <p>I am creating a custom login for my django application and problem occurs when i click <code>logout</code> on template I programmed it so it go to index page but the url in the browser remains <code>http://127.0.0.1:8000/logout/</code> even reaching index page. I want it to become <code>http://127.0.0.1:8000/</code> .</p>
  
  <p>views.py</p>
  
  <pre><code>def logout(request):
      try:
          del request.session['uid']
          return render(request, 'home.html')
      except:
          pass
      return render(request, 'home.html')
  
  def home_page(request):
      return render(request, 'home.html')
  </code></pre>
  
  <p>template</p>
  
  <pre><code> &lt;p&gt;
      Publisher Dashboard, Welcome {{ user.name }}.
      &lt;a href="{% url 'logout' %}" class="btn btn-primary"&gt;Logout&lt;/a&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>from django.conf.urls import url
  from django.contrib import admin
  from mainapp import views
  
  urlpatterns = [
  url(r'^$', views.home_page, name='homepage'),
  url(r'^registration/$', views.signup_user, name='signup_user'),
  ....
  url(r'^logout/$', views.logout, name='logout'),
  ]
  </code></pre>