Django development console custom/debug messages
Is there a way to print messages to开发者_运维问答 Django development console?
I'm running 1.1 Django in buildout environment.
So running bin/django runserver
(manage.py runserver
) it shows development console where it writes resources, actions taken (equivalent of apache access/error logs(?)).
I want to print custom messages to that console for debugging purposes that it wouldn't kill the action just notice me.
Should i use logging
module or is there other way?
If you're sure you just want it in development, you can simply use print
- the message appears in the console.
However, you will need to delete the print statement before you deploy to production, as this will cause an error with Apache.
A better long-term solution is to use the logging
module, configured to output to the console.
精彩评论