Django,从 php 到 Django
我有一个使用 Django 完成的网站,之前是使用 PHP 和 CodeIgniter 完成的。我已将网站移至 Webfaction,更改了 DNS 和所有其他配置,但现在我的电子邮件充满了这样的错误:
Error (EXTERNAL IP): /index.php/main/leer/7497
我不知道为什么 Django 应用程序正在寻找来自 PHP 应用程序的页面,特别是因为 PHP应用程序位于另一台主机中。
I have a website done with Django, that was previously done with PHP and CodeIgniter. I've moved the website to Webfaction, changed the DNS and all other configurations, but now my email is full of errors like this:
Error (EXTERNAL IP): /index.php/main/leer/7497
I don't know why the Django app is looking for pages from the PHP app, specially since the PHP app was in another host.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些 URL 是来自您的旧网站吗?这可能是因为人们拥有过时的书签,尝试导航到它们,却收到了 404 错误。您可能需要考虑捕获这些错误,并重定向到响应代码为 302 的新 URL。
我无法想象这些错误是由 Django 引起的(除非这些报告来自 Django 报告 404,而且它是免费的) 。
Are those URLs from your old site? That's probably a case of people having stale bookmarks, trying to navigate to them, and getting 404s. You might want to consider catching those, and redirecting to the new URL with response code 302.
I can't imagine those errors are caused by Django (except in the sense that the reports are from Django reporting 404s, which it does for free).
我同意上面的观点。只是想添加您应该使用 django.contrib.redirects 来移动重定向。
您可以在此处阅读更多相关信息
I agree with above. Just want to add you should use django.contrib.redirects to move the redirects.
You can read more about it here