When using to generate a sitemap, I encountered a error when running the command. What is the cause of this error and how can I resolve it?django-static-sitemapsTypeError: ‘type’ object is not iterablepython manage.py refresh_sitemap
**views.py**
from django.contrib import sitemaps
from . import models
class WebSitemaps(sitemaps.Sitemap):
changefreq = "weekly"
priority = 0.5
def items(self):
return models.ArticleModel.objects.all()
def location(self, obj):
return f"/{obj.aid}.html"
**settings.py**
STATICSITEMAPS_ROOT_SITEMAP = 'index.sitemaps.WebSitemaps'```
**urls.py**
urlpatterns = [
re_path('^sitemap-baidu/', include('static_sitemaps.urls')),
]
enter image description here
New contributor
user24269818 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1