配置Django开发服务器输出 [英] Configuring the Django development server output

查看:142
本文介绍了配置Django开发服务器输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以配置Django开发服务器的输出以显示发出请求的客户端的IP地址?

Is it possible to configure the output from the Django development server to show the IP address of the client making the request?

推荐答案

在我们的列表中,这是Django新发行版的标准mod".对于Django 1.2.1,在django/core/servers/basehttp.py,第614行中,更改:

This in our list for "standard mods" to new Django releases. For Django 1.2.1, in django/core/servers/basehttp.py, line 614, change:

   msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)

   msg = "[%s] %s %s\n" % (self.log_date_time_string(),
                       self.client_address[0], format % args)

这篇关于配置Django开发服务器输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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