Intermediate concepts: I am having troubles implementing the sitemap


#1

I get an error saying "TypeError: object() takes no parameters". What to do? Here is my sitemap.py:

import datetime
from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
from .models import Thing

class ThingSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.5

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

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

class StaticSitemap(Sitemap):
    lastmod = None
    priority = 0.5
    changefreq = "weekly"

    def items(self):
        return ['about', 'contact', 'browse',]

    def location(self, item):
        return reverse(item)

class HomepageSitemap(Sitemap):
    priority = 1
    changefreq = "daily"

    def items(self):
        return ['home',]

    def lastmod(self, obj):
        return datetime.date.today()

    def location(self, item):
        return reverse(item)

#2

What line does the error occur?


#3

#4

Thanks! Can you actually copy/paste the entire error (including the stuff below) into pastebin.com?


#5

http://pastebin.com/0pqxQkY5


#6

Drat, that wasn’t as helpful as I thought it would be. :P

Have you tried removing Sitemap blocks (like the StaticSitemap, HomepageSitemap, etc) and seeing if it works?


#7

Didn’t work…


#8

Fixed my problem. I had screwed up my import statement. Dumb me … The nice folks over at StackOverflow helped me. You can read the full thread here.


#9

Thanks for letting me know the solution! Sorry I wasn’t able to help more on my own. :)