In Django, how do I allow print statements to work with Apache WSGI?

前端 未结 4 953
一生所求
一生所求 2020-12-11 18:46

\"print\" only works in development server. But what if I want it to work in Apache? Just in case I forget to comment it out...I want to be able to go smoothly without causi

4条回答
  •  有刺的猬
    2020-12-11 19:21

    If you want to write print statements to Apache error log, you can use sys.stderr:

    import sys
    sys.stderr.write('log mgs')
    

    then it will be in apache error log file.

提交回复
热议问题