我试图为我的应用创建一个主页,但添加STATIC_ROOT
和STATICFILES_DIR
后,我的页面一直在加载。它在我的终端中显示来自('127.0.0.1',49634)的管道中断。这是我的home.html
This is my settings.py
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = 'static/'
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
this is my 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)
1条答案
按热度按时间icnyk63a1#