Opened 9 years ago
Closed 8 years ago
#26079 closed New feature (wontfix)
add prefered/default protocol in the sites framework
Reported by: | Eric | Owned by: | Eric |
---|---|---|---|
Component: | contrib.sites | Version: | dev |
Severity: | Normal | Keywords: | sites protocol |
Cc: | Eric | Triage Stage: | Someday/Maybe |
Has patch: | no | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I think adding a preferred/default protocol in the sites framework would be a great addition for generating full url's to django websites.
specially when generating url from action not coming from a request like the sitemaps ping_google that assumes the protocol to be http:
current_site = Site.objects.get_current() url = "http://%s%s" % (current_site.domain, sitemap_url)
so we could have something like this instead:
current_site = Site.objects.get_current() url = "%s://%s%s" % (current_site.protocol, current_site.domain, sitemap_url)
and maybe even add a shortcut for the site's base url
Attachments (1)
Change History (7)
by , 9 years ago
Attachment: | sites.patch added |
---|
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
this is just a proposition, if the feedback seems positive I will make all proper tests and Documentation
comment:3 by , 9 years ago
Description: | modified (diff) |
---|
I'm not immediately convinced that a database field is the way to go for a couple reasons:
- It would make data less portable between development (where SSL is often not in use) and production.
- I'm not sure it's a common case that only some sites would use SSL but not others.
A third-party library called django-hosts, which djangoproject.com uses, adds a setting called HOSTS_SCHEME to solve this. I think there's been some discussion about merging at least parts of this library into core since it solves common problems.
See also #10944 (we might close this ticket as a duplicate of that one) and #23829 (about customizing ping_google
to allow https). I think the best course of action would be to consider this feedback and write to the DevelopersMailingList with your proposal. Either solution of a new setting or a new database field need feedback from a wider audience. Thanks!
comment:4 by , 9 years ago
Cc: | added |
---|
I've started the discussion at https://groups.google.com/forum/#!topic/django-developers/CzxaPDe8fpI
comment:5 by , 9 years ago
Triage Stage: | Unreviewed → Someday/Maybe |
---|
comment:6 by , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Closing in absence of consensus on the mailing list.
proposed changes