Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service /media/ urls from a relative not absolute URL #228

Open
adamboutcher opened this issue Feb 13, 2025 · 4 comments
Open

Service /media/ urls from a relative not absolute URL #228

adamboutcher opened this issue Feb 13, 2025 · 4 comments

Comments

@adamboutcher
Copy link
Contributor

The media files are all defined using absolute URL and not relative which causes issues if trying to service the app through a proxy.

@adamboutcher
Copy link
Contributor Author

adamboutcher commented Feb 13, 2025

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")),

@rocky
Copy link
Member

rocky commented Feb 13, 2025

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"

@adamboutcher
Copy link
Contributor Author

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.

@rocky
Copy link
Member

rocky commented Feb 13, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants