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

相關文章
相關標籤/搜索