TAGS :Viewed: 14 - Published at: a few seconds ago
[ No Entry Matches Query django ]
Okay so I've really weird problem. I've mapped my url like this :
url(r'^contact/$', 'blog.views.contact'),
however whenever I go to /contact/, I get a 404, I've cheked my re several time and can't figure out what is the problem here..
Here's contact view if it's relevant :
def contact(request):
"""
"""
if request.method == "POST":
form = ContactForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
send_mail("New contact form submission!", cd["message"],
"marijus.merkevicius@gmail.com", cd["email"])
return redirect('blog.views.index')
else:
form = ContactForm()
return render_to_response("contact.html", {"form" : form},
context_instance = RequestContext(request))
Answer 1
A few possibilities:
1) The URLs file in question is not getting included at all. Test this by confirming that other URLs in the same file are working.
2) Another earlier pattern is matching your URL and then throwing a 404 in the view. Test this by moving this pattern to be the first pattern in your root URLs.
3) Something in your view is throwing the 404. This doesn't look likely, based on the code you've included, but test this by replacing the view with something simple, like a direct_to_template