mathics-django
mathics-django copied to clipboard
Service /media/ urls from a relative not absolute URL
The media files are all defined using absolute URL and not relative which causes issues if trying to service the app through a proxy.
So I understand the need for the scripts to use absolute URLs so they serve correctly if you're using subdirs for fuctions etc
settings.py
BASE_URL = os.environ.get("MATHICS_DJANGO_URL", None
STATIC_URL = BASE_URL+"/media/"
urls.py:
re_path(r"^"+settings.BASE_URL, include("mathics_django.web.urls")),
Ok - please work this up into a PR.
A shorter way to write the last 4 lines is:
STATIC_URL = status_url+"/media" if static_url is None else "/media"
Ok - please work this up into a PR.
A shorter way to write the last 4 lines is:
STATIC_URL = status_url+"/media" if static_url is None else "/media"
My original post didnt reliably work I have however edited this.
Ok - please work this up into a PR. A shorter way to write the last 4 lines is: STATIC_URL = status_url+"/media" if static_url is None else "/media"
My original post didnt reliably work I have however edited this.
Ok. Good to hear. If you want to get the change into the code base, please put in a PR when you can.
You are in the best position to test whether things work. What I can do is verify that it doesn't break the behavior I use.
FYI I've PR'd some additional changes.
These changes have been deployed locally for few a few months to our users and we've had no complaints, I would consider this issue resolved. If anyone does have a bug relating to these changes then please hit me up.