my structure is like this:

my_project
       blog
              ....
              sitemaps.py
              ....
       my_project
              ....
              urls.py
              ....

Inside sitemaps.py :

from django.contrib.sitemaps import Sitemap
from .models import *

class BlogPostsSitemap(Sitemap):
    changefreq = 'daily'
    priority = 0.9
    def items(self):
        return PostModel.published.all()

    def lastmod(self,obj):
        return obj.updated


my case:
1. In settings.py I want to import BlogPostsSitemap.
2. I tried like this
[image: image.png]

but then I got an error "ValueError: attempted relative import beyond
top-level package" when I ran the server.

Is anyone here got the solution? Or maybe some references how to
create sitemap on django?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANV3w%3DYhzmvdPakW%2B%2BgwNjG%3DzGiZ61wpmuDPdDOO%2BgxFJnU%3DSQ%40mail.gmail.com.

Reply via email to