A setting isn't so mad. Many Django projects I've seen use a similar custom
setting for constructing URLs outside of requests.

One question though, how will we support projects that are served at
multiple domains? Would Django only support the "main" site through
BASE_URL and require you to perform URL construction for other domains as
required?

On Thu, Apr 6, 2023 at 8:11 AM Sarah Boyce <sarahvboyc...@gmail.com> wrote:

> Hello 👋
>
> This is a summary of some previous discussions which need opening up to
> the group 👍
>
> 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
> <https://code.djangoproject.com/ticket/34028> #16734
> <https://code.djangoproject.com/ticket/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."
>
> New settings are a little controversial, so what do you think about this
> approach? Are there any other ideas or concerns?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/df82f370-e96a-498c-ac08-89d34d5cadd5n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/df82f370-e96a-498c-ac08-89d34d5cadd5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM1Hwy5rd1j36BLt%3DeHzqaae6ypNqh_DYYZwfFAqg0f%2B7A%40mail.gmail.com.
  • Pro... Sarah Boyce
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
      • ... Florian Apolloner

Reply via email to