Location of Django logs and errors

后端 未结 3 1772
北海茫月
北海茫月 2020-12-04 08:31

I\'ve set up django server with nginx, and it gets 403 error in some of the pages.

Where can I find the django logs? where can I see the errors in detail?

3条回答
  •  抹茶落季
    2020-12-04 08:55

    Add to your settings.py:

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'handlers': {
            'file': {
                'level': 'DEBUG',
                'class': 'logging.FileHandler',
                'filename': 'debug.log',
            },
        },
        'loggers': {
            'django': {
                'handlers': ['file'],
                'level': 'DEBUG',
                'propagate': True,
            },
        },
    }
    

    And it will create a file called debug.log in the root of your. https://docs.djangoproject.com/en/1.10/topics/logging/

提交回复
热议问题