Django升级到1.10,MEDIA_ROOT发生TypeError错误
Getting error: “TypeError: view must be a callable or a list/tuple in the case of include().” when running Django Server
解决方案:http://stackoverflow.com/questions/40619208/getting-error-typeerror-view-must-be-a-callable-or-a-list-tuple-in-the-case-o
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
或者
from django.views.static import serve
urlpatterns = [
...
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
]

浙公网安备 33010602011771号