Opened 15 years ago

Closed 13 years ago

Last modified 12 years ago

#10909 closed (fixed)

Allow use of the Sitemaps Framework without requiring the sites contrib application

Reported by: QingFeng Owned by: nobody
Component: Contrib apps Version: dev
Severity: Keywords:
Cc: qingfeng@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django Sitemaps Framework does not allow the use of the Domain Settings Site

In settings.py add a variable DOMAIN

DOMAIN = 'www.example.com'

example:
location of the place, do not rely on the domain name Site Settings

class KhufuSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return [obj,obj,obj]

    def location(self,obj):
        return "/v/%s/" % obj["kid"]

    def lastmod(self, obj):
        return datetime.strptime(obj["savedate"],'%Y-%m-%d')

Attachments (4)

sitemaps.patch (1.2 KB ) - added by QingFeng 15 years ago.
sitemaps2.patch (1.9 KB ) - added by QingFeng 15 years ago.
Google ping modify the domain settings
10909.diff (1.9 KB ) - added by Chris Beaven 15 years ago.
sitemaps_custom_domain_docs_tests.diff (7.5 KB ) - added by daniellindsley 14 years ago.
And now with a docstring (docs+tests).

Download all attachments as: .zip

Change History (15)

by QingFeng, 15 years ago

Attachment: sitemaps.patch added

comment:1 by Joey Wilhelm, 15 years ago

I won't close this myself, as I have no official word in the development of Django... but this appears to be invalid.

DOMAIN is not a setting which is currently set or used anywhere else in Django. Nor does it appear to really be necessary. Django can't account for every setting that you may add to your project.

in reply to:  1 comment:2 by QingFeng, 15 years ago

Replying to Tarken:

I won't close this myself, as I have no official word in the development of Django... but this appears to be invalid.

DOMAIN is not a setting which is currently set or used anywhere else in Django. Nor does it appear to really be necessary. Django can't account for every setting that you may add to your project.

:)To do so is to facilitate, as some projects with less than a database, the current code can not output the Sitemap

comment:3 by QingFeng, 15 years ago

New Patch:

1. Google ping modify the domain settings

by QingFeng, 15 years ago

Attachment: sitemaps2.patch added

Google ping modify the domain settings

comment:4 by Chris Beaven, 15 years ago

Keywords: sitemaps removed
Needs documentation: set
Summary: Django Sitemaps Framework does not allow the use of the Domain Settings SiteAllow use of the Sitemaps Framework without requiring the sites contrib application
Triage Stage: UnreviewedAccepted
Version: 1.0SVN

It's a useful idea, but adding a setting isn't the way to go about it. I'm attaching a better version - it just needs docs if someone wants to write them.

by Chris Beaven, 15 years ago

Attachment: 10909.diff added

comment:5 by QingFeng, 15 years ago

milestone: 1.2

comment:6 by daniellindsley, 14 years ago

milestone: 1.21.3
Needs documentation: unset

Added docs & tests (plus SmileyChris' patch).

by daniellindsley, 14 years ago

And now with a docstring (docs+tests).

comment:7 by anonymous, 14 years ago

Is this a dupe of #10235?

comment:8 by Mark Lavin, 14 years ago

This is essentially the same problem as #10235 and #10608 but I would say adding the get_domain to SiteMap is probably better than the other solutions offered which try into RequestSite.

comment:9 by Luke Plant, 13 years ago

Resolution: fixed
Status: newclosed

(In [13980]) Fixed #14386, #8960, #10235, #10909, #10608, #13845, #14377 - standardize Site/RequestSite usage in various places.

Many thanks to gabrielhurley for putting most of this together. Also to
bmihelac, arthurk, qingfeng, hvendelbo, petr.pulc@…, Hraban for
reports and some initial patches.

The patch also contains some whitespace/PEP8 fixes.

comment:10 by Luke Plant, 13 years ago

(In [13987]) [1.2.X] Fixed #14386, #8960, #10235, #10909, #10608, #13845, #14377 - standardize Site/RequestSite usage in various places.

Many thanks to gabrielhurley for putting most of this together. Also to
bmihelac, arthurk, qingfeng, hvendelbo, petr.pulc@…, Hraban for
reports and some initial patches.

The patch also contains some whitespace/PEP8 fixes.

Backport of [13980] from trunk. Some items could be considered features
(i.e. supporting RequestSite in various contrib apps), others are definite
bugs, but it was much more robust to backport all these tightly related
changes together.

comment:11 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top