How to see details of Django errors with Gunicorn?

后端 未结 5 1607
无人及你
无人及你 2021-01-31 08:33

I just deployed my Django (1.6) project with gunicorn and Nginx.

It seems to be working fine but I have one page were I\'m getting an HTTP 500 error and I can\'t find an

5条回答
  •  故里飘歌
    2021-01-31 09:21

    This configuration worked for me. Add --capture-output --enable-stdio-inheritance with gunicorn command like below.

    /home/ubuntu/inside-env/bin/gunicorn --access-logfile /var/log/access_file_g.log --error-logfile /var/log/error_file_g.log --capture-output --enable-stdio-inheritance --workers 3 --bind unix:/home/ubuntu/path-to-project/webapp.sock project.wsgi:application
    

    With this setup, do enable logging in this way

    import logging 
    logging.basicConfig(level='DEBUG')
    
    logging.info('hello world')
    

    This way you will get to see the errors in the App as well.

提交回复
热议问题