#10944: Site app should be able to make absolute URLs. -------------------------------+-------------------------------------- Reporter: jdunck | Owner: krzysiumed Type: New feature | Status: assigned Component: contrib.sites | Version: 1.0 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------+--------------------------------------
Comment (by mbertheau): Replying to [comment:9 SmileyChris]: > What's actually the good in the `{% site_url %}` tag? It seems like it should be able to take other sites, too (if you only have one site, why bother using this over the standard `request.build_absolute_uri()`?) I often find myself in a situation where I need an absolute URL but cannot use `request.build_absolute_uri()` because I don't have a request: cron jobs, celery tasks or api modules that I don't want to couple to the request. Afaics Django currently doesn't have a place to generate absolute URLs without a request, so everyone is hacking their own way. `Site` is a possible place to do it, but it'd have to learn about the scheme and port to be complete. `RequestSite` could take these from new settings, maybe: `SITE_SCHEME`, `SITE_PORT`. -- Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:19> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.b2e8514355153a4c521be47bca431453%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.