开发者

Configuring the Django development server output

Is it possible to configure the output from the Django development server to show the IP address of the client making the request?开发者_高级运维


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)

to

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


Other answers I've had suggested to me:

  1. Consider Gunicorn as a dev server: http://gunicorn.org/ (orginNell)
  2. Consider using class inheritance on basehttp.py to create a new management command and avoid messing with the core code (orginNell)
  3. Use a real server (Harro)
  4. Write some middleware to log to a file (Harro)
  5. Consider replacing the built-in server with django-devserver: http://github.com/dcramer/django-devserver (mikeshantz)
  6. I like cherrypy with django: http://www.cherrypy.org/ (John M)
  7. Cherokee is very good too: http://www.cherokee-project.com/ (John M)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜