The logs of POST/GET requests from Django application on Apache

◇◆丶佛笑我妖孽 提交于 2020-01-24 22:18:07

问题


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

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

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!


回答1:


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

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.



来源:https://stackoverflow.com/questions/11336672/the-logs-of-post-get-requests-from-django-application-on-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!