美文网首页
Django web开发

Django web开发

作者: endian | 来源:发表于2018-05-10 16:23 被阅读0次

    Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
    正确做法是:
    from django.urls import path
    from learning_logs.views import index
    app_name = 'learning_logs'

    urlpatterns = [
    #主页
    path('', index, name='index'),
    ]

    Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))

    Reverse for 'topic ' not found. 'topic ' is not a valid view function or pattern name.


    image.png

    箭头处多了个空格

    相关文章

      网友评论

          本文标题:Django web开发

          本文链接:https://www.haomeiwen.com/subject/huftdftx.html