Django 1.6: name 'sitemaps' is not defined

前端 未结 2 2043
逝去的感伤
逝去的感伤 2021-01-20 10:44

I\'m trying to implement sitemaps in my django application but i get the following error. I\'m using the django sitemap\'s framework. I don\'t know what I\'m doing wrong.

2条回答
  •  长情又很酷
    2021-01-20 11:19

    Martijn already provided correct answer, I just want to add a more general note about namespaces in Python: every name you use in Python has to come from somewhere. There is a number of built-in names that are always available, e.g. dir(). Other than the built-ins, every name has to be either created in your own code in the module OR imported from some other module or package:

    >>> x
    Traceback (most recent call last):
      File "", line 1, in 
    NameError: name 'x' is not defined
    >>> x = 1
    >>> x
    1
    >>> sys
    Traceback (most recent call last):
      File "", line 1, in 
    NameError: name 'sys' is not defined
    >>> import sys
    >>> sys
    
    

提交回复
热议问题