Esempio n. 1
0
    def test_domain_override(self):
        sitemaps = override_sitemaps_domain({'test': ExampleSitemap})
        sitemap = sitemaps['test']
        if callable(sitemap):
            sitemap = sitemap()

        url = sitemap.get_urls()[0]
        domain = 'http://{domain}'.format(domain=get_static_site_domain())
        self.assertTrue(url['location'].startswith(domain))
Esempio n. 2
0
    def test_domain_override(self):
        sitemaps = override_sitemaps_domain({'test': ExampleSitemap})
        sitemap = sitemaps['test']
        if callable(sitemap):
            sitemap = sitemap()

        url = sitemap.get_urls()[0]
        domain = 'http://{domain}'.format(domain=get_static_site_domain())
        self.assertTrue(url['location'].startswith(domain))
Esempio n. 3
0
from cms.sitemaps import CMSSitemap
from staticgen.sitemaps import override_sitemaps_domain

from staticgen_demo.blog.sitemaps import BlogSitemap

admin.site.site_header = _('Staticgen Demo')
admin.site.index_title = _('Dashboard')
admin.site.site_title = _('Staticgen Demo')

sitemaps = {
    'cmspages': CMSSitemap,
    'posts': BlogSitemap,
}

urlpatterns = [
    url(r'^manage/', include(admin.site.urls)),
    url(r'^sitemap\.xml$', sitemap,
        {'sitemaps': override_sitemaps_domain(sitemaps)},
        name='django.contrib.sitemaps.views.sitemap'),
    url(r'^robots\.txt$',
        TemplateView.as_view(template_name='robots.txt', content_type='text/plain'),
        name='robots.txt'),
    url(r'^404/$', TemplateView.as_view(template_name='404.html'),
        name='page_not_found'),
    url(r'^error/$', TemplateView.as_view(template_name='500.html'),
        name='application_error'),
    url(r'^', include('cms.urls')),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)