Django出现的错误

  • 1.TypeError: view must be a callable or a list/tuple in the case of include().
    • 缘由:url(r"^uploads/(?P<path>.*)$", 'django.views.static.serve', {"document_root": settings.MEDIA_ROOT}),这种写法是Django1.10以前的写法。1.10以后的写法是这样的
    • from django.views.static import serve
    • url(r"^uploads/(?P<path>.*)$", serve, {"document_root": settings.MEDIA_ROOT}),
  • 2.ERRORS:?: (urls.E006) The MEDIA_URL setting must end with a slash.  System check identified 1 issue (0 silenced).python

    • 缘由:这是由于MEDIA_URL = 'uploads'没有‘/’django

    • 解决:MEDIA_URL = '/uploads/'app

  • 3.Dependency on app with no migrations: blogide

    • 解决办法:python2 manage.py makemigrationsurl

相关文章
相关标签/搜索