Fix several issues with building static media files.
Review Request #12413 — Created June 24, 2022 and submitted
We had issues that popped up with building of static media files. These
didn't prevent building static media, but mostly because we're lucky.
The first issue is that
FORCE_BUILD_MEDIAwasn't being respected. We
were setting that using
settings.pywas getting an empty string out when using
os.putenv(), we don't actually modify the current
process, just subprocesses. The correct API to use is just
which stores the variable in the local process's environment and wraps
This has been updated to just use
os.environin all cases.
Another is that we had conflicts when building files. Both
FileSystemFinderwould find the exact same
static media files, and this would log complaints about duplicates.
Likely this isn't new behavior, but the logging is new.
The reason for the conflict is that we defined specific directories
containing static media files to process (for
lib), where the
djbletsversion was also found in the
libwere found in the
reviewboardapp (both in
djbletsapps to be in
since we reference templates and other state from there. Given that we
need these, and both contain
static/directories, we can get by with
AppDirectoriesFinder. There's no need to keep
anymore, or maintain a list of
Tested a complete static files rebuild with both finders, without
FileSystemFinder, and without
AppDirectoriesFinder. Backed up each
version and compared directory contents.
FileSystemFinderhad no effect on the contents of the directory,
but it did remove the errors.
AppDirectoriesFindercaused a change in what files we collected,
ruling that out as an option.
Successfully built packages, ran the server without any static media issues,
and ran unit tests.