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

Use a more reliable source of the static files URL #649

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

illia-v
Copy link
Contributor

@illia-v illia-v commented Jul 22, 2024

I have a case when SQL explorer pages don't render correctly because paths of all static files are wrong.

django-storages is used and AWS_LOCATION is set, so actual paths are prefixed.
The SQL explorer uses settings.STATIC_URL to construct URLs of static files, but settings.STATIC_URL doesn't contain the prefix in the described configuration.

There may be other cases when storage classes change URLs, let's build the URLs using a configured Django storage.

@chrisclark
Copy link
Collaborator

Love this! Thank you.

I have struggled to get all of the various django static stuff to be really solid, and I think this helps. I will review shortly, merge, and get a beta release out by the end of this week (along with a bunch of other improvements). I'll get it tested in a more complex environment next week and hopefully have a final release done by Aug 2.

@chrisclark chrisclark merged commit 4b31630 into explorerhq:master Jul 23, 2024
9 checks passed
@illia-v
Copy link
Contributor Author

illia-v commented Jul 23, 2024

@chrisclark thank you for reviewing this and providing the expected release date!

@illia-v illia-v deleted the fix-static branch July 23, 2024 15:18
@chrisclark
Copy link
Collaborator

@illia-v FYI 5.1b1 is on pypi:
https://pypi.org/project/django-sql-explorer/5.1b1/

Will try to cut a final release sometime in the coming week.

@chrisclark
Copy link
Collaborator

I have tested this on demo.sqlexplorer.io, with similar django-storages settings:

https://github.com/explorerhq/demo-site/blob/master/explorer_demo/settings.py

And it seems to be working well. I will cut a release tomorrow after one more round of testing in another environment.

@illia-v
Copy link
Contributor Author

illia-v commented Jul 29, 2024

Thanks! I checked the beta release in my env, and it works correctly there too

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

Successfully merging this pull request may close these issues.

2 participants