Friday, October 9, 2015

reverse() error while importing view function

Hello!

I get noreversematch error for url 'home' at deployed site with debug True.
The same works well at localhost. 

I should make debug False for deployment but any reason why view function import fails only at live site?

Following are the details.
 
templates/site/base.html

      <ul class="nav navbar-nav navbar-right">
        <li><a href="{%  url 'home' %}">Home</a></li>


site/urls.py

from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from . import views
from django.conf.urls.static import static
from django.conf import settings


urlpatterns = [
    url(r'^$', views.index, name='home'),


site/views.py

from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from cxl.forms import ContactUsForm

def index(request):
    context = {}
    return render(request, 'site/index.html', context)


Thanks,
Klerp

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5153752-ff74-451b-bbd7-3404daabff10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment