重定向Django管理.py输出(在windows中)到文本fi

2024-10-01 13:43:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试重定向管理.py但只有一些输出被重定向到文本文件。如何将所有输出重定向到文本文件?在

我的命令提示符:

C:\Development\web-py\p1st2\pianos1st-system>python manage.py test > test_results.txt
.....................................................................................................................
----------------------------------------------------------------------
Ran 117 tests in 2.026s

OK

我的测试_结果.txt文件:

^{pr2}$

我使用的是Windows7 32位SP1和Django SVN。在


Tags: pytesttxtwebmanagetestssystemresults
1条回答
网友
1楼 · 发布于 2024-10-01 13:43:55

某些类型的控制台消息将绕过输出重定向(或调用任何使用“>;”的命令)。我注意到了系统标准写入()例如这样做了。在

在末尾添加“2>;1”有助于:

python manage.py test purchaseplans > test_results.txt 2>&1

编辑:解释发生了什么:
http://en.wikipedia.org/wiki/Redirection_(computing)#Redirecting_to_and_from_the_standard_file_handles

相关问题 更多 >