Django Error u“'polls” is not a registered namespace

后端 未结 13 2605
误落风尘
误落风尘 2021-01-31 07:41

Yesterday I was working on my first app using this tutorial. It\'s a Poll and Choice app. The first page displays the question and when you click on the question it\'s suppose t

13条回答
  •  温柔的废话
    2021-01-31 08:06

    The problem is in the tutorial. While adding the namespace( in your case 'myapp') to your URLconf, the tutorial uses the following code of line:

    app_name = 'myapp'
    

    The Django framework for some reason treats it as a unicode string. Instead please enclose the name of your app in double quotes instead of single quotes. For example,

    app_name = "myapp"
    

    This will most certainly solve your problem. I had the same problem and doing so solved it.

提交回复
热议问题