如果您已調試並且工作正常,則應顯示所有錯誤。
但是,無論您是否可以讓Django向您發送任何服務器錯誤的電子郵件,這些錯誤對於解決生產環境問題都將特別有幫助。在error reporting的文檔會有所幫助,具體如下:
最起碼,你需要指定EMAIL_HOST並可能EMAIL_HOST_USER和EMAIL_HOST_PASSWORD,
我覺得這是標準的日誌記錄,但無論如何,在您的settings.py
文件確保ADMINS =()
不爲空,然後檢查您的日誌記錄配置。
當您使用DEBUG
模式時,請確保您沒有包含require_debug_false
過濾器。
ADMINS = (
# ('Your Name', '[email protected]'),
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
如果你掌握了所有這些,那麼你應該對你的錯誤有所瞭解。
有時日誌的實際響應結束(AJA使用TastyPie)。檢查它可能包含堆棧跟蹤的客戶端自身的響應。 – 2015-02-05 16:17:24
您是否正確設置了ALLOWED_HOSTS? – 2015-02-05 16:31:12