Hi, has anyone experienced this issue and found a fix? "Exception Value: 'set' object has no attribute 'values'".
Any help would be great. Thanks in advance
urls.py (main):
from django.contrib import admin
from django.urls import path, include
from django.contrib.sitemaps.views import sitemap
from blog.sitemaps import PostSitemap
Hi, has anyone experienced this issue and found a fix? "Exception Value: 'set' object has no attribute 'values'". Any help would be great. Thanks in advance
Error Request Method: GET Request URL: http://127.0.0.1:8000/sitemap.xml
Django Version: 4.1.2 Python Version: 3.11.1 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog.apps.BlogConfig', 'taggit', 'django.contrib.sites', 'django.contrib.sitemaps']
Traceback (most recent call last): File "C:\Python\venvs\311_all\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Python\venvs\311_all\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "C:\Python\venvs\311_all\Lib\site-packages\django\contrib\sitemaps\views.py", line 34, in inner response = func(request, args, **kwargs) File "C:\Python\venvs\311_all\Lib\site-packages\django\contrib\sitemaps\views.py", line 120, in sitemap maps = sitemaps.values()
Exception Type: AttributeError at /sitemap.xml Exception Value: 'set' object has no attribute 'values'
sitemaps.py: from django.contrib.sitemaps import Sitemap from .models import Post
class PostSitemap(Sitemap): changefreq = 'weekly' priority = 0.9
urls.py (main): from django.contrib import admin from django.urls import path, include from django.contrib.sitemaps.views import sitemap from blog.sitemaps import PostSitemap
sitemaps = { 'posts', PostSitemap, }
urlpatterns = [ path('admin/', admin.site.urls), path('blog/', include('blog.urls', namespace='blog')), path('sitemap.xml', sitemap, {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap') ]