I have a question now. I want to hide out the message by django server such as 'get /index.html...', that is the response to client side. How can I do it?
Asked
Active
Viewed 691 times
2
-
I don't know the answer but, I'm really curious on why you would want to impose such behaviour ? – Jonas Geiregat Aug 30 '12 at 06:47
-
you want for development server that comes with django? – Rohan Aug 30 '12 at 06:47
-
If you're talking about apache verbosity, have a look at http://www.webreference.com/programming/Apache-Logging/index.html – Hedde van der Heide Aug 30 '12 at 06:50
-
Thx. I have a django_socketio server that handles instant messages, I want to hide the messages because maybe it's more efficient and what's most important is that when I type cmd in it, I won't be interrupted by the messages. Does that make sense? – liao Aug 30 '12 at 06:57
1 Answers
2
Hiding development server's messages is not supported directly by django, but you can do that by modifying django's code. Just open file:
[PYTHON site-packages]/django/core/servers/basehttp.py
in a text editor and comment the line (line 200 in django 1.4.1):
sys.stderr.write(msg)
and to find python site packages, you can type this in a terminal (cmd):
python -c "import sys; sys.path = sys.path[1:]; import django; print(django.__path__)"

Amir Ali Akbari
- 5,973
- 5
- 35
- 47
-
I think you are right. But when I commented the line, the server terminal still printed the 'GET /...' messages. Is there anything wrong? – liao Aug 30 '12 at 08:27
-
that worked on my computer, try restarting the server. Or maybe you are editing the wrong file (multiple django installation), etc. – Amir Ali Akbari Aug 30 '12 at 09:31
-
-
to hide all output, simply add `>nul 2>&1` to the end of any command. see: http://stackoverflow.com/questions/1262708/suppress-command-line-output – Amir Ali Akbari Aug 30 '12 at 12:11
-