Django errors

  • 1.TypeError: view must be a callable or a list/tuple in the case of include().
    • Reason: url(r"^uploads/(?P<path>.*)$", 'django.views.static.serve', {"document_root": settings.MEDIA_ROOT}), this is written before Django1.10 of writing. After 1.10 it is written like this
    • 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).

    • Reason: This is because MEDIA_URL = 'uploads' without '/'

    • Solved: MEDIA_URL = '/uploads/'

  • 3.Dependency on app with no migrations: blog

    • Solution: python2 manage.py makemigrations

                

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325482283&siteId=291194637