来自 Apache 上的 Django 应用程序的 POST/GET 请求的日志 [英] The logs of POST/GET requests from Django application on Apache

查看:33
本文介绍了来自 Apache 上的 Django 应用程序的 POST/GET 请求的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Django 开发服务器非常好,它实时显示所有 POST/GET 请求以及其他事件的日志.来自 Django 开发服务器的日志示例:

Django development server is really nice, it shows the log of all POST/GET requests as well as other events in real time. Example of logs from Django dev server:

[04/Jul/2012 19:23:27] "GET /static/images/sprites/submit_url_hover.png HTTP/1.1" 200 7088
[04/Jul/2012 19:23:42] "POST /validate_link HTTP/1.1" 200 0
[04/Jul/2012 19:23:44] "POST /download_link HTTP/1.1" 200 0

它对于调试、找出 500 错误的来源等非常有用.我最近在 Apache 上部署了我的 Django 应用程序,并在 Apache 上寻找类似于 Django Dev Server 的日志.显然有 Apache 错误日志(代码段在下面):

It's very useful for debugging, figuring out the sources of 500 errors, etc. I've recently deployed my Django app on Apache and looking for logs analogous to that of Django Dev Server on Apache. There is obviously Apache error logs (snippet is below):

[Wed Jul 04 18:37:45 2012] [error] [u'microsoft', u'design', u'logos']
[Wed Jul 04 23:51:01 2012] [error] [client 140.180.6.212] File does not exist: /srv/my_project/app/portnoy/site_media/favicon.ico

但这不是我想要的.我的站点有一个简单的链接提交功能,可以在本地运行(在 Django 开发服务器上),但在实际站点(运行 Apache)上不起作用.因此,在 Apache 上查看 Django 开发服务器样式日志将非常有帮助.知道在哪里可以看吗?提前致谢,祝 4 日快乐!

But that's not what I want. My site has a simple link submission functionality which works locally (on Django dev server), but is not working on the actual site (running Apache). So seeing the Django dev server style logs on Apache will be really helpful. Any idea where can I look at? Thank in advance and happy 4th!

推荐答案

检查 apache 的 access.log,您将在其中看到处理的每个请求和发送的响应.

Check access.log for the apache where you will see each request processed and response sent.

此外,如果您还没有尝试过,请在您的设置文件中设置 DEBUG=True,以便 django 会向您显示详细的错误、跟踪和其他有用信息.

Also, if you have not tried yet, set DEBUG=True in your settings file so django will show you detail error, trace and other useful information.

这篇关于来自 Apache 上的 Django 应用程序的 POST/GET 请求的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆