Home > front end >  Why is my function get_absolute_url is merging my domain into my website name?
Why is my function get_absolute_url is merging my domain into my website name?

Time:10-20

I'm using the Django sitemap framework, and I have to use the function get_absolute_url to render the site URL in the sitemap. However, I'm facing a problem because my link is becoming: exampleio.io instead of example.io.

My function in my model is it:

def get_absolute_url(self):
        return reverse('packages', args=[self.name])

My function in the sitemap.py

class ExampleSitemap(Sitemap):

    protocol = "https"
    changefreq = "weekly"
    priority = 0.7
    limit = 500

    def items(self):
        return Example.objects.all()

I'm getting:

<sitemap>
<loc>http://exampleio.io/sitemap-examples.xml</loc>
</sitemap>

CodePudding user response:

Check django /admin, under the Sites section. Make sure your site is correctly named there.

  • Related