内部链接损坏问题
我不断收到 django 发来的关于内部链接损坏的电子邮件,我无法解释:
Referrer: http://www.emetor.com/forum/
Requested URL: /thanks/forum/
User agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
IP address: xxx.xxx.xxx.xxx
它们似乎是由于推荐人页面上的联系表单造成的,成功提交后会重定向到 http://www.emetor.com/thanks/。当我尝试联系提交时,一切正常。但我担心我可能会错过一些联系提交!
有人可以解释一下问题可能出在哪里吗?如果您需要更多信息,请告诉我...
联系表单执行以下操作:
<form action="/contact/" method="post">
在联系视图中:
def contact(request):
if request.method == 'POST': # If the form has been submitted...
form = ContactForm(request.POST) # A form bound to the POST data
if form.is_valid(): # All validation rules pass
...
send_mail(subject, message, sender_email, recipients)
return HttpResponseRedirect('/thanks/') # Redirect after POST
else:
form = ContactForm() # An unbound form
return render_to_response('contact.html', RequestContext(request,{'form': form}))
I keep getting emails from django about broken INTERNAL links which I can't explain:
Referrer: http://www.emetor.com/forum/
Requested URL: /thanks/forum/
User agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
IP address: xxx.xxx.xxx.xxx
It seems that they are due to a contact form on the referrer page, which after successful submission redirects to http://www.emetor.com/thanks/. When I try a contact submission, everything works just fine. But I'm afraid that I might miss some contact submissions!
Somebody who has an explanation about where the problem could be? Please let me know if you need further information...
The contact form does the following:
<form action="/contact/" method="post">
And in the view for contact:
def contact(request):
if request.method == 'POST': # If the form has been submitted...
form = ContactForm(request.POST) # A form bound to the POST data
if form.is_valid(): # All validation rules pass
...
send_mail(subject, message, sender_email, recipients)
return HttpResponseRedirect('/thanks/') # Redirect after POST
else:
form = ContactForm() # An unbound form
return render_to_response('contact.html', RequestContext(request,{'form': form}))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
日志文件显示请求的 url 是“/thanks/forum/”,尽管您提到成功提交重定向是“/thanks”,因此请检查创建重定向 url 的代码。
其他解释可能是该链接是由某些爬虫或机器人保存的,并且它尝试请求该页面。
Log file shows that requested url is "/thanks/forum/", although you mention that successful submission redirect is "/thanks", so check the code where redirect url is created.
Other explanation could be that this link is saved by some crawler or bot and it try to request that page.