wagtail / wagtail

A Django content management system focused on flexibility and user experience

Home Page:https://wagtail.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with Missing Static File wagtailadmin/css/core.css in Wagtail 6.0.2with DEBUG=False

alyrace opened this issue · comments

Upgraded from wagtail 3.0 to 6.0.2, and was getting this error when going to /admin/ path, when DEBUG is False:

File "C:\Users\arace\Sites\boards\.venv\lib\site-packages\django\contrib\staticfiles\storage.py", line 513, in stored_name
    raise ValueError(
ValueError: Missing staticfiles manifest entry for 'wagtailadmin/css/core.css'
"GET /admin/ HTTP/1.1" 500 363

After setting DEBUG to True and running collectstattic command, then setting back to False, it worked without issue.

I'm using django version 4.2.11, so I thought perhaps it is was an issue with ManifestStaticFilesStorage.
However not error did not occur with a separate application where I had upgraded from 5.2 to 6.0.1 and then 6.0.2, as I had run collectstaic before upgrading to 6.0.1. Also using django version 4.2.11 and DEBUG False.

Sorry I was not clearer in my previous post, first time reporting possible bug.

Thank you for adding this @alyrace

It is recommended to run collectstatic after an upgrade, especially between major versions, just before re-running the server. This ensures that Django gets all the change static files.

The file in question was removed at some point in the 3 -> 4 or 4 -> 5 changes. From your description, you did not run collectstatic hence the error, rather than a bug.

It is possible we could improve the documentation, but I struggle a bit to think where we should call this out. Perhaps in the release notes between major versions, something along the lines of "Please make sure you run django-admin collectstatic?

edit: as @gasman points out, this is already described in https://docs.wagtail.org/en/stable/releases/upgrading.html#upgrade-process

Thanks for the extra clarification!

Everything you describe here sounds like the expected behaviour - as per the upgrading documentation, it's expected that you'll need to run ./manage.py collectstatic on deploying a new version of Wagtail, in order for any updated JS/CSS in that release to be visible through the web server. It shouldn't be necessary to set DEBUG=True while running collectstatic - if it fails without that step, please provide the error message that occurs at that point and we can investigate further.

Thanks for response, well I feel dumb haha. I have to set to True first on my production server, but not locally. Since I can't recreate right now, it's for sure of my own making sorry to bother!

@alyrace not at all. We all learn something new every day!
I hope this is the only snafu with the upgrade and that you and your site users can enjoy all the changes in the latest versions