2012-01-25 85 views
0

我剛剛在Dreamhost上部署了我的應用程序,並且在上傳文件時它停止工作。乘客只會產生500個內部錯誤。它適用於我的開發設置。
我的乘客文件看起來像:搬到生產環境打破了我的應用程序

import sys, os 
sys.path.append(os.getcwd()) 
sys.path.append(os.path.join(os.getcwd(), '/photosoc')) 

os.environ['DJANGO_SETTINGS_MODULE'] = "photosoc.settings" 
import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

我得到標準的404錯誤(調試仍處於啓用狀態)。我不得不改變我的網址,雖然文件:

from django.conf.urls.defaults import patterns, include, url 
from competition.models import Image 
from competition import * 
from django.contrib import admin 
from django.contrib.staticfiles.urls import staticfiles_urlpatterns 
from django.conf import settings 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 
admin.site.register(Image) 

urlpatterns = patterns('', 
    # Examples: 
    # url(r'^$', 'photosoc.views.home', name='home'), 
    # url(r'^photosoc/', include('photosoc.foo.urls')), 

    # Uncomment the admin/doc line below to enable admin documentation: 
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    url(r'^admin/', include(admin.site.urls)), 
# url(r'^image/$', 'competition.views.index'), 
    url(r'^image/uploadImage', 'competition.views.uploadImage'), 
    url(r'^image/uploadCompleted', 'competition.views.uploadCompleted'), 
    url(r'^image/uploadFailed', 'competition.views.uploadFailed'), 
) 

urlpatterns += patterns('', 
    (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT})) 

以下幾點:

from django.conf.urls.defaults import patterns, include, url 
from competition.models import Image 
from competition import * 
from django.contrib import admin 
from django.conf import settings 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 
admin.site.register(Image) 

urlpatterns = patterns('', 
    # Examples: 
    # url(r'^$', 'photosoc.views.home', name='home'), 
    # url(r'^photosoc/', include('photosoc.foo.urls')), 

    # Uncomment the admin/doc line below to enable admin documentation: 
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    url(r'^admin/', include(admin.site.urls)), 
# url(r'^image/$', 'competition.views.index'), 
    url(r'^image/uploadImage', 'competition.views.uploadImage'), 
    url(r'^image/uploadCompleted', 'competition.views.uploadCompleted'), 
    url(r'^image/uploadFailed', 'competition.views.uploadFailed'), 
) 

這是我從交換機從開發到生產中的應用做出的唯一改變。那麼還有什麼可能出錯?

+0

不要其他網址的工作? –

+0

關於dreamhost你有訪問你的Web服務器日誌嗎?如果它產生一個500,那麼錯誤應該記錄在某個地方? – dm03514

+0

您應該嘗試訪問服務器日誌,以便您可以讀取堆棧跟蹤(並在此處發佈)。如果您無法訪問您應該在設置中設置管理員電子郵件地址的日誌,它會給你一個更好的想法,如果問題可能是 –

回答

0

您可能有權限問題。

看起來你正在寫圖像文件。運行Django的進程是否有權寫入文件?當您使用./manage.py runserver在本地運行Django時,Django將獲得從命令行運行的用戶權限,但是在您使用Apache用戶權限運行的典型生產環境中。該用戶可能沒有寫入這些圖像文件的權限。您可以暫時將寫目錄硬編碼到/ tmp,以查看這是否有所幫助。

當然,你真的需要看到500錯誤堆棧跟蹤知道發生了什麼。

相關問題