2015-02-06 85 views
4

我主持我在數字海洋的網站,它讓我這封電子郵件。 [Django]錯誤(外部IP):內部服務器錯誤:/favicon.icoDjango的錯誤(外部IP):內部服務器錯誤:/favicon.ico

目前我還沒有采取任何域,並通過IP衝浪。是因爲這個錯誤嗎?

而且當我嘗試上傳它不無論是從客戶端或管理方上傳任何圖片。它向我發送3個4錯誤消息有關的所有圖像.. \

回溯是:

Internal Server Error: /img/loading.gif 
Traceback (most recent call last): 
File "/var/www/html/eclinicnepal/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 150, in get_response 
response = callback(request, **param_dict) 
File "/var/www/html/eclinicnepal/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 105, in _wrapped_view 
response = view_func(request, *args, **kwargs) 
File "/var/www/html/eclinicnepal/venv/lib/python2.7/site-packages/django/views/defaults.py", line 31, in page_not_found 
body = template.render(RequestContext(request, {'request_path': request.path})) 
File "/var/www/html/eclinicnepal/venv/lib/python2.7/site-packages/django/template/context.py", line 209, in __init__ 
updates.update(processor(request)) 
File "/var/www/html/eclinicnepal/eclinicnepal/eclinicnepal/context_processor.py", line 4, in notifications 
'unseen_notifications': request.unseen_notifications, 
AttributeError: 'WSGIRequest' object has no attribute 'unseen_notifications' 

像錯誤最後一行說,有在該文件中沒有任何錯誤。它看起來像

def notifications(request): 
"Context processor for adding notifications to the context." 
return { 
    'unseen_notifications': request.unseen_notifications, 
    'seen_notifications': request.seen_notifications 
} 

在我的地方這就是沒有錯誤完美的工作..請告訴我的錯誤?

爲什麼我的圖片沒有上傳?

+0

每次都是一樣的錯誤嗎?如果是這樣,你什麼時候將'unseen_notifcations'添加到'request'? – vishen 2015-02-06 03:22:54

+0

找出是什麼造成這種情況?我在上下文處理器中也收到了關於favicon訪問的錯誤信息,但我不知道如何或爲什麼。 – abarax 2015-05-29 01:10:16

回答

4

如果我理解正確的話,你在這裏報告的兩個問題。您的圖標和WSGIRequest錯誤的內部服務器錯誤。

對於圖標,如果你的靜態設置不正確,或者如果您使用的是IP而不是域名,如果你的Apache虛擬主機配置是不正確的......你會得到這樣的錯誤。我發現從服務器上的本地到開發並不是微不足道的,所以我會先確認一下。

對於上下文處理器。我可能會建議您先解決這個問題,然後再將其加回原處。通常,像這樣的故障排除可能會揭示導致解決方案的其他錯誤。

我用數字海洋幾個項目,我已經部署Django的項目,使用多次虛擬環境這個平臺,讓我看到了相關的靜態內容和背景許多錯誤。

看一看這篇博客部署到數字海洋時覆蓋了大部分基礎知識:具有相同配置

http://www.pdxpixel.com/blog/configuring-dango-on-apache-with-mod_wsgi/

http://www.pdxpixel.com/blog/setting-up-django-on-ubuntu-with-virtualenv-and-mod_wsgi/

第二個交易,但使用virtualenv我推薦。有一條學習曲線,但它非常值得。