Base URL configuration options (#4749)

* Improve construct_absolute_url method

- Look for hard-coded site URL if provided
- Otherwise look for specified site URL
- Otherwise look at the provided request object

* Refactor existing code which used base URL setting

* Update docs

* Validate that a provided base URL is valid
This commit is contained in:
Oliver authored and GitHub committed 2023-05-02 22:14:57 +10:00
1 parent 10c3d101e8
commit 61d613ff34
9 files changed
+75 -33

No files matched your search

@@ -222,8 +222,8 @@ def inventree_splash(**kwargs):
@register.simple_tag()
def inventree_base_url(*args, **kwargs):
"""Return the INVENTREE_BASE_URL setting."""
return InvenTreeSetting.get_setting('INVENTREE_BASE_URL')
"""Return the base URL of the InvenTree server"""
return InvenTree.helpers.get_base_url()
@register.simple_tag()