-
Notifications
You must be signed in to change notification settings - Fork 3
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
Automatically run Django's collectstatic
command
#108
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The classic Heroku Python buildpack automatically runs the Django `collectstatic` command: https://github.com/heroku/heroku-buildpack-python/blob/main/bin/steps/collectstatic This adds equivalent support, with a couple of improvements: - This implementation performs more checks to see whether the app is actually using the static files feature before trying to run it (reducing the number of cases where users have to manually disable it). - The collectstatic symlink feature has been enabled, as requested in heroku/heroku-buildpack-python#1060. - Symlinked `manage.py` files are now supported, as requested in heroku/heroku-buildpack-python#972. - The error messages are finer grained/more useful. - There are many more tests. There is currently no way to force disable the feature (beyond removing `django.contrib.staticfiles` from `INSTALLED_APPS` in the app's Django config). Adding this depends on us deciding how best to handle buildpack options, so will be added later. This uses the new `utils::run_command_and_capture_output` added in #106. See: * https://docs.djangoproject.com/en/4.2/howto/static-files/ * https://docs.djangoproject.com/en/4.2/ref/contrib/staticfiles/ * https://docs.djangoproject.com/en/4.2/ref/settings/#settings-staticfiles Fixes #5. GUS-W-9538294.
edmorley
added
the
classic buildpack parity
Features required for parity with the classic Heroku Python buildpack
label
Sep 12, 2023
Malax
approved these changes
Sep 12, 2023
A legacy Django version (1.18, which is EOL) is now tested, as well as ensuring that env vars are passed to manage.py.
edmorley
force-pushed
the
django-collectstatic
branch
from
September 12, 2023 17:54
7afe5c5
to
42b8298
Compare
Merged
heroku-linguist bot
added a commit
to heroku/cnb-builder-images
that referenced
this pull request
Sep 19, 2023
## heroku/python ### Added - Django's `collectstatic` command is now automatically run for Django apps that use static files. ([#108](heroku/buildpacks-python#108)) Co-authored-by: heroku-linguist[bot] <136119646+heroku-linguist[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
classic buildpack parity
Features required for parity with the classic Heroku Python buildpack
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The classic Heroku Python buildpack automatically runs the Django
collectstatic
command:https://github.com/heroku/heroku-buildpack-python/blob/main/bin/steps/collectstatic
This adds equivalent support, with a couple of improvements:
manage.py
files are now supported, as requested in Fix Django sites with manage.py symlinks or similar unconventional configurations heroku-buildpack-python#972.There is currently no way to force disable the feature (beyond removing
django.contrib.staticfiles
fromINSTALLED_APPS
in the app's Django config, or removing themanage.py
script). Supporting this depends on us deciding how best to handle buildpack options, so will be added later, in #109.The build log output and error messages are fairly reasonable already (and a significant improvement over the classic buildpack), and will be further polished as part of the future build output overhaul.
The implementation uses the new
utils::run_command_and_capture_output
added in #106.See:
Fixes #5.
GUS-W-9538294.