django中-TypeError: view must be a callable or a list/tuple in the case of include().

这个问题弄了好久:

    这个是django版本原因导致的错误:

    原来的配置

from django.conf import settings
    url(r'uploads/(?P<path>.*)$',\
                'django.views.static.serve',\   
                {'document_root':settings.MEDIA_ROOT,})  

    更新后的配置

from django.views.static import serve
    url(r'^uploads/(?P<path>.*)$',\
        serve,\
        {'document_root':settings.MEDIA_ROOT,})    

    这样才能运行! 

猜你喜欢

转载自blog.csdn.net/bc521bc/article/details/80620828