I'm trying to redirect the output from manage.py to a text file, but only some output is getting redirected to the text file. How do I redirect all output to the text file?
My command prompt:
C:\Development\web-py\p1st2\pianos1st-system>python manage.py test > test_results.txt
.....................................................................................................................
----------------------------------------------------------------------
Ran 117 tests in 2.026s
OK
My test_results.txt file:
Creating test database for alias 'default'...
Destroying test database for alias 'default'...
I'm using Windows 7 32bit SP1 and Django SVN.
Certain types of console messages will bypass the output redirection (or whatever using ">" is called). I noticed that sys.stderr.write() for instance did this.
Adding a "2>&1" at the end helps with this:
python manage.py test purchaseplans > test_results.txt 2>&1
Edit: Explanation of what is going on:
http://en.wikipedia.org/wiki/Redirection_(computing)#Redirecting_to_and_from_the_standard_file_handles
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With