1)修改配置文件:
('image'为上传图片的根目录)
MEDIA_URL ='/image/'
MEDIA_ROOT = os.path.join(BASE_DIR, "image")
2)修改url配置
from django.conf.urls.staticimport static
from .import settings
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
1)修改配置文件:
('image'为上传图片的根目录)
MEDIA_URL ='/image/'
MEDIA_ROOT = os.path.join(BASE_DIR, "image")
2)修改url配置
from django.conf.urls.staticimport static
from .import settings
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)