Django sitemap change base URL

django, sitemap

Solution

Solved, I redefined my own `get_urls`. It works:

class MySitemap(Sitemap):
    changefreq = "never"
    priority = 0.5
    location = ""

    def get_urls(self, site=None, **kwargs):
        site = Site(domain='example.com', name='example.com')
        return super(MySitemap, self).get_urls(site=site, **kwargs)
 
    def items(self):
        return MyObj.objects.all().order_by('pk')[:1000]

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

Problem

I'm using https://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/?from=olddocs. I have a sitemap generated from `api.example.me` for the domain: `example.com`. Can I, with Django, specify a base URL? Now with `location()` method return: `api.example.me/page/3123` instead of `example.com/page/3123` Is this possible?

Original source