2016-01-12 63 views
0

當media_root位於項目根目錄之外時,django-oscar未顯示產品圖片,因此將media_root更改爲project_root/public/media會引發此錯誤。SuspiciousFileOperation at/index/

SuspiciousFileOperation at /index/ 
The joined path (.../barbaranew/media/media_root/images/products/malaysian1.png) is located outside of the base path component (.../barbaranew/barbaralee_site/public/media) 

而且爲什麼當media_root在外面時圖像不顯示,認爲這是更安全的方式。 謝謝
我試圖做遷移和遷移,但它仍然給我同樣的錯誤。

+0

的[可疑文件Operation..The加入路徑......位於基座路徑組件之外(HTTP可能重複: //stackoverflow.com/questions/33625173/suspicious-file-operation-the-joined-path-is-located-outside-of-the-base-pa) – wogsland

回答

0

我將此添加到我的urls.py和解決的問題MEDIA_ROOT

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