#34461: Constructing urls outside the request cycle
-----------------------------------------+------------------------
Reporter: Sarah Boyce | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
There is a need to have some kind of URL outside the request cycle (such
as sending emails which need to create a link).
For constructing a correct `MEDIA_URL` / `STATIC_URL` we wanted to use the
script prefix to allow for more dynamic changes (ie allow a user to move
to a subpath without having to change multiple variables). In the request
cycle you can use `get_script_prefix()` for this but outside the request
cycle this isn't currently very achievable (see related tickets #34028
#16734).
There is a current proposal from Florian Apolloner
> I am really starting to lean towards introducing a setting (yes!) called
`BASE_URL` that can be set to `https://mysite.com/subpath`. This would
allow for a) generating URLs outside a request context and b) allow us to
mostly ignore script prefix. We could also use a relative `STATIC_URL` and
append it to `BASE_URL`. This way there would be just one setting that
requires changing and many projects hopefully would make that configurable
via env vars etc.
--
Ticket URL: <https://code.djangoproject.com/ticket/34461>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701875275ef52-9bf9d64b-3b45-4d0e-8387-15b577dedf13-000000%40eu-central-1.amazonses.com.