我在 Django 1.6 上遇到了这个问题
这是我的sitemaps.py
from django.contrib import sitemaps
from django.core.urlresolvers import reverse
from datetime import datetime
class ContratalosSitemap(Sitemap):
def __init__(self, names):
self.names = names
def items(self):
return self.names
def changefreq(self, obj):
return 'weekly'
def lastmod(self, obj):
return datetime.now()
这是我的urls.py
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.sitemaps import Sitemap
from sitemaps.py import ContratalosSitemap
#Declaration for sitemaps url
sitemaps = {
'pages' : ContratalosSitemap,
}
urlpatterns = patterns(
'apps.contratalos.views',
url(r'c/(?P<slug>\.*[^ ]{1,128})?/', 'c', name='content'),
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps'$
)
我被卡住了,可能是什么原因?
但是还没有运气=/
请问有什么想法吗?
提前致谢!