2017-04-13 252 views
-1

在我的項目,我想創建自定義視圖404頁創建自定義視圖

setting.py

DEBUG = False 


ALLOWED_HOSTS = ['*'] 

STATIC_URL = '/static/' 
STATIC_ROOT = os.path.join(BASE_DIR, 'static') 
MEDIA_URL = "/media/" 
MEDIA_ROOT = os.path.join(os.path.join(BASE_DIR), "media_cdn")ode here 

Urls.py

if settings.DEBUG: 
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 

handler404 = 'myapp.views.handler404' 
handler500 = 'myapp.views.handler500' 

當我在settings.py文件中使DEBUG = False,靜態文件加載不正確。截圖附上相同。

static files not loading

請幫我解決這個問題。

+3

這與404頁面有什麼關係? –

回答