Upgraded Bootstrap to 3.4.1 and added CSS source maps#8591
Upgraded Bootstrap to 3.4.1 and added CSS source maps#8591lovelydinosaur merged 1 commit intoencode:masterfrom
Conversation
|
Python 3.9 failure is from master. |
|
@adamchainz I played a bit with the issue and I found out the failing CI is because there are extra tests only for Python 3.9 which use a built version of DRF. The files included during the build are defined in django-rest-framework/MANIFEST.in Line 4 in 8b2cccc You can check the CI runs on my branch: https://github.com/KOliver94/django-rest-framework/pull/1 |
1158432 to
65943bb
Compare
|
Thank you, I"ve added to |
|
Ah I didn't read the logs enough, the failure on master was due to the missing source map: |
|
Fantastic. Thanks all. 🙏🏼 |
|
How do I fix this in my project? Cant run collectstatic/ |
|
I think this fix hasn't been released yet. You can:
|
|
You can also add source map files, even empty ones, to your project's static folder. Use the right file names: |
|
from cli calling |
This is not a good idea as it will break static assets for most projects. |
|
For those of you sniffing around for a quick fix, here's a reasonably portable one-liner that will touch find "$(python -c 'import rest_framework as rf; print(rf.__path__[0])')" -name '*.min.css' -exec touch '{}.map' \;And if you're just really itchin' for those sweet, sweet sourcemaps, you can incant the following curse: (
cd "$(python -c 'import rest_framework as rf; print(rf.__path__[0])')" && \
curl -fsSL "https://github.com/encode/django-rest-framework/archive/refs/heads/master.tar.gz" \
| tar --extract --gzip --wildcards --strip-components=2 '*.map'
)Oh, and here's that comment you'll forget to write the moment it starts working: |
|
@adamchainz Is there a plan to make a new release with this fix? |
|
Yes, #8599 is where that is happening. |
|
@adamchainz Thank you so much 🌷 I couldn't find that, sorry. |
|
I ran into this issue as well, while working through @wsvincent 's excellent Django for APIs book. My fix was somewhat complicated because I was also working within a Poetry environment. My fix was to downgrade to 4.0. # Rip Django out, and add a version which will stay at the latest 4.0.whatever.
poetry remove django
poetry add "django==~4.0" # thatnks @adamchainz
poetry update
# Check that your repo's Django version is now, in fact, 4.0.whatever.
poetry run python -m django --version
# Try this again.
poetry run python manage.py collectstatic(For anyone reading in the future, this fix comes around Chapter 4, "Library API", right when we have to start adding in |
|
@hiAndrewQuinn Downgrading is probably the right approach there. Does the book not reccomend using a specific Django version from the start though? I know Will only advertises the book as updated for Django 4.0 at current. Also a tip, you don't want to use Django 4.0.0, but instead 4.0.7, which is the latest release in the 4.0 series. It has a bunch of security and bug fixes. See the 4.0.7 release notes, and the previous linked versions. If you don't use the latest release of a given series, you may encounter already-fixed bugs, which is just frustrating. |
|
He does, and you are correct. I edited my code to reflect that for any future wannabe Djangoists. |
Fixes #8587. 3.4.1 has a few changes including an XSS security fix. Adding the CSS source maps will allow DRF to be used with Django 4.1 and
ManifestStaticFilesStorage.