windows中使用django時報錯:A server error occurred. Please contact the administrator.

這是因爲在視圖函數中使用了get函數,獲取了不存在的數據 例如:數據庫中不存在一條name爲hello1的數據,使用如下語句訪問 message = Message.objects.get(name='hello1') 就會報錯 message = Message.objects.get(name='boddy1') 解決方法: 見下圖:    點擊上圖框中的鏈接後,自動進入debug.py文件的
相關文章
相關標籤/搜索