-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Error in admin/base_site.html when using ManifestStaticFilesStorage #1895
Comments
Which version? Should have been fixed in 4.3, see #1772 I'll close assuming it's fixed, please re-open if not. |
This exists on master. #1772 is an unrelated issue. |
Sorry I knew this was a duplicate issue but when I searched I linked to the wrong one - the dupe is #1805. I still feel like it's the fault of any staticfiles backend to not give a valid path for a directory, and I closed the original issue off since the backend in question was third-party. What do you think of the likelihood of getting this changed in Django for the backend you're using? |
It doesn't work to build URLs to static files with a prefix. A filename like foo.css will get turned into a file like foo.3a393a.css in production, so the staticfiles backend needs to know the exact file and can't generate a prefix for you. |
That makes sense, I just think that a statcfiles backend should be able to produce a path to a directory. We'll need to add something ourselves that does this in order to fix it. |
Landing here because I got bitten by this with Mezzanine 4.3.1.
I strongly disagree, there is no notion of directories (or even files) on the Web, only resources with URLs that produce representations. It goes against the staticfiles API in Django.
|
Closes stephenmcd#1895 It breaks sites on production that use the ManifestStaticFilesStorage. For such cases, Django provides the "get_static_prefix" template tag. But it's an incitement to bypass the storage mechanism to produce the URL to cache (by appending a hash in this case). And I don't understand how it could work with more "exotic" yet valid backends relying on cloud storage or CDNs, where the source file path and the URL path won't match one to one. I advise against this usage and call for its deprecation.
Closes stephenmcd#1895 It breaks sites on production that use the ManifestStaticFilesStorage. For such cases, Django provides the "get_static_prefix" template tag. But it's an incitement to bypass the storage mechanism to produce the URL to cache (by appending a hash in this case). And I don't understand how it could work with more "exotic" yet valid backends relying on cloud storage or CDNs, where the source file path and the URL path won't match one to one. I advise against this usage and call for its deprecation.
It breaks sites on production that use the ManifestStaticFilesStorage. For such cases, Django provides the "get_static_prefix" template tag. But it's an incitement to bypass the storage mechanism to produce the URL to cache (by appending a hash in this case). And I don't understand how it could work with more "exotic" yet valid backends relying on cloud storage or CDNs, where the source file path and the URL path won't match one to one. I advise against this usage and call for its deprecation. From: bors-ltd@88aa6c9 Related to: stephenmcd#1895
* Try and fix admin link error * Try and fix admin link error mk2 * Try and fix admin link error mk2 * Try and fix admin link error mk3 * try and fix the thing * A better registration message * Fix broken admin link thing * Fix broken admin link thing * Fix my bad imports * Fix drag and drop issues * Attempt to fix the related manager error * Some merge updates I think? * Require Treebeard to use its manager with displayable models (Althon sitemap bug) Some merge updates I think? * Undo my treebeard changes * Overshard's S3 speedup * Add REPLY_TO_EMAIL setting * Fix for when we don't have a reply_to * Bump django install requires version * Fixes for django 2.2 * Add messages to installed apps * Fix for the broken sitemaps and link system * Rollback template tags * Fix Token_type errors * Fix allowed_hosts * Refactor keywords_fields to work with Django 2.2 * Take media out of static directory * Fix TokenType * Fix line length issues * Add removed TokenType import * Fix password reset test * Backwards compat changes to mezzanine tags * Fixes for next_url * Fix setup.py requirements * Remove future imports from accounts * Remove future imports from bin * Remove future imports from blog * Fix imports for rss and tumblr import commands * Add additional breadcrumb classes * Use 2.0 compatible urls for blog pages * Remove future imports for boot * Remove future imports for conf * Remove future imports for core * 2.0 compat urls for core * Fix metaclass for core models * Fix future imports for auth_backends.py * Remove additional jquery ui from core admin (it's loaded in the base instead) * Remove future imports from forms * Remove future imports from galleries * Remove future imports from generic * 2.0 compatible urls for generic * Remove future imports from pages * 2.0 compatible urls for pages * version bump nestedSortable * Add additional classes for page menus * version bump bootstrap * fix ajax_csrf and keywords fields * Fix token_type * Fix page tree sortable * Revert "version bump bootstrap" This reverts commit 3eb8157 * Bump jquery file versions * Fix indentation * Add localhost and 127.0.01 to ALLOWED_HOSTS * Fix blog url * Update tox to use new python and django * Revert "Move jQuery setup for ajax/csrf outside of document.ready handler." This reverts commit 543c437 * Rollback version number * Changes based on code review * Changes based on code review * Fix URLs for Python 3.5 * Tox test py3.5 * Update travis * Update travis * Fix adding link inlines. Mezzanine issue #1634 * Style fix for M2M widget * Revert menu changes made in August * Update tox to test against the fermor fork rather than the master * Make widget scripts load in correct order in dj2.2 Make all admin widget which rely on window.jQuery load jquery.init.js and all that rely on window.django.jQuery also load jquery.js as per 2.2 upgrade instructions * Disable required on TinyMceWidget textareas, allowing forms with required fields to submit on dj2.2 TinyMCE does not put content back into the <textarea>, so we want to allow it to submit when empty. Currently a form with a required field with a TinyMceWidget would be impossible to submit and no error would show since the textarea has been hidden. * Roll back page_tree based review * Django required version < 3 * Version bump of nestedSortable * https://stackoverflow.com/questions/54336787 * caracteres extraños en plantilla * PEP8 Fix * Limit admin thumb images to 100% * Remove fermor specific style overrides * Styles for page-model and readonly textareas * Rename admin CSS class "field-box" to "fieldBox". (This addresses a change made in Django 2.1 to fix Django bug #29248.) * Updated formfield_for_dbfield() calls to include request argument * PEP8 (black) formatting * Fix __admin_media_prefix__ pointing to nonexistent resource It breaks sites on production that use the ManifestStaticFilesStorage. For such cases, Django provides the "get_static_prefix" template tag. But it's an incitement to bypass the storage mechanism to produce the URL to cache (by appending a hash in this case). And I don't understand how it could work with more "exotic" yet valid backends relying on cloud storage or CDNs, where the source file path and the URL path won't match one to one. I advise against this usage and call for its deprecation. From: bors-ltd@88aa6c9 Related to: #1895 Co-authored-by: Frankie Robertson <[email protected]> Co-authored-by: Marcos Sánchez Provencio <[email protected]> Co-authored-by: zriv <[email protected]> Co-authored-by: Tuk Bredsdorff <[email protected]> Co-authored-by: Peter Dermott <peter.dermott@:gmail.com> Co-authored-by: Diego Rabatone Oliveira <[email protected]>
BREAKING CHANGE: Support for Python 2 and Django < 2.2 has been dropped * Try and fix admin link error * Try and fix admin link error mk2 * Try and fix admin link error mk2 * Try and fix admin link error mk3 * try and fix the thing * A better registration message * Fix broken admin link thing * Fix broken admin link thing * Fix my bad imports * Fix drag and drop issues * Attempt to fix the related manager error * Some merge updates I think? * Require Treebeard to use its manager with displayable models (Althon sitemap bug) Some merge updates I think? * Undo my treebeard changes * Overshard's S3 speedup * Add REPLY_TO_EMAIL setting * Fix for when we don't have a reply_to * Bump django install requires version * Fixes for django 2.2 * Add messages to installed apps * Fix for the broken sitemaps and link system * Rollback template tags * Fix Token_type errors * Fix allowed_hosts * Refactor keywords_fields to work with Django 2.2 * Take media out of static directory * Fix TokenType * Fix line length issues * Add removed TokenType import * Fix password reset test * Backwards compat changes to mezzanine tags * Fixes for next_url * Fix setup.py requirements * Remove future imports from accounts * Remove future imports from bin * Remove future imports from blog * Fix imports for rss and tumblr import commands * Add additional breadcrumb classes * Use 2.0 compatible urls for blog pages * Remove future imports for boot * Remove future imports for conf * Remove future imports for core * 2.0 compat urls for core * Fix metaclass for core models * Fix future imports for auth_backends.py * Remove additional jquery ui from core admin (it's loaded in the base instead) * Remove future imports from forms * Remove future imports from galleries * Remove future imports from generic * 2.0 compatible urls for generic * Remove future imports from pages * 2.0 compatible urls for pages * version bump nestedSortable * Add additional classes for page menus * version bump bootstrap * fix ajax_csrf and keywords fields * Fix token_type * Fix page tree sortable * Revert "version bump bootstrap" This reverts commit 3eb8157 * Bump jquery file versions * Fix indentation * Add localhost and 127.0.01 to ALLOWED_HOSTS * Fix blog url * Update tox to use new python and django * Revert "Move jQuery setup for ajax/csrf outside of document.ready handler." This reverts commit 543c437 * Rollback version number * Changes based on code review * Changes based on code review * Fix URLs for Python 3.5 * Tox test py3.5 * Update travis * Update travis * Fix adding link inlines. Mezzanine issue stephenmcd#1634 * Style fix for M2M widget * Revert menu changes made in August * Update tox to test against the fermor fork rather than the master * Make widget scripts load in correct order in dj2.2 Make all admin widget which rely on window.jQuery load jquery.init.js and all that rely on window.django.jQuery also load jquery.js as per 2.2 upgrade instructions * Disable required on TinyMceWidget textareas, allowing forms with required fields to submit on dj2.2 TinyMCE does not put content back into the <textarea>, so we want to allow it to submit when empty. Currently a form with a required field with a TinyMceWidget would be impossible to submit and no error would show since the textarea has been hidden. * Roll back page_tree based review * Django required version < 3 * Version bump of nestedSortable * https://stackoverflow.com/questions/54336787 * caracteres extraños en plantilla * PEP8 Fix * Limit admin thumb images to 100% * Remove fermor specific style overrides * Styles for page-model and readonly textareas * Rename admin CSS class "field-box" to "fieldBox". (This addresses a change made in Django 2.1 to fix Django bug #29248.) * Updated formfield_for_dbfield() calls to include request argument * PEP8 (black) formatting * Fix __admin_media_prefix__ pointing to nonexistent resource It breaks sites on production that use the ManifestStaticFilesStorage. For such cases, Django provides the "get_static_prefix" template tag. But it's an incitement to bypass the storage mechanism to produce the URL to cache (by appending a hash in this case). And I don't understand how it could work with more "exotic" yet valid backends relying on cloud storage or CDNs, where the source file path and the URL path won't match one to one. I advise against this usage and call for its deprecation. From: bors-ltd@88aa6c9 Related to: stephenmcd#1895 Co-authored-by: Frankie Robertson <[email protected]> Co-authored-by: Marcos Sánchez Provencio <[email protected]> Co-authored-by: zriv <[email protected]> Co-authored-by: Tuk Bredsdorff <[email protected]> Co-authored-by: Peter Dermott <peter.dermott@:gmail.com> Co-authored-by: Diego Rabatone Oliveira <[email protected]>
BREAKING CHANGE: Support for Python 2 and Django < 2.2 has been dropped From: bors-ltd@88aa6c9 Related to: stephenmcd#1895 Co-authored-by: Frankie Robertson <[email protected]> Co-authored-by: Marcos Sánchez Provencio <[email protected]> Co-authored-by: zriv <[email protected]> Co-authored-by: Tuk Bredsdorff <[email protected]> Co-authored-by: Peter Dermott <peter.dermott@:gmail.com> Co-authored-by: Diego Rabatone Oliveira <[email protected]>
The fix proposed in #1938 has been added separately |
base_site.html
has this code:window.__admin_media_prefix__ = '{% static "admin" %}/';
, which tries to get the URL of a static file that doesn't exist ('admin'). This causes ManifestStaticFilesStorage to raise an error:The text was updated successfully, but these errors were encountered: