Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 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: master
Severity: Keywords:
Cc: qingfeng@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 5 years ago.
sitemaps2.patch (1.9 KB) - added by qingfeng 5 years ago.
Google ping modify the domain settings
10909.diff (1.9 KB) - added by SmileyChris 5 years ago.
sitemaps_custom_domain_docs_tests.diff (7.5 KB) - added by daniellindsley 4 years ago.
And now with a docstring (docs+tests).

Download all attachments as: .zip

Change History (15)

Changed 5 years ago by qingfeng

comment:1 follow-up: Changed 5 years ago by Tarken

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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.

comment:2 in reply to: ↑ 1 Changed 5 years ago by qingfeng

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 Changed 5 years ago by qingfeng

New Patch:

1. Google ping modify the domain settings

Changed 5 years ago by qingfeng

Google ping modify the domain settings

comment:4 Changed 5 years ago by SmileyChris

  • Keywords sitemaps removed
  • Needs documentation set
  • Summary changed from Django Sitemaps Framework does not allow the use of the Domain Settings Site to Allow use of the Sitemaps Framework without requiring the sites contrib application
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.0 to SVN

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.

Changed 5 years ago by SmileyChris

comment:5 Changed 5 years ago by qingfeng

  • milestone set to 1.2

comment:6 Changed 4 years ago by daniellindsley

  • milestone changed from 1.2 to 1.3
  • Needs documentation unset

Added docs & tests (plus SmileyChris' patch).

Changed 4 years ago by daniellindsley

And now with a docstring (docs+tests).

comment:7 Changed 4 years ago by anonymous

Is this a dupe of #10235?

comment:8 Changed 4 years ago by mlavin

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 Changed 4 years ago by lukeplant

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 4 years ago by lukeplant

(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 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.