Fix initial Python/Django compatibility issues when building static media.
Review Request #10664 — Created Aug. 15, 2019 and submitted
Our script for building static media files could pull in the wrong
version of Django, based on the local environment and which versions
were installed. If the system had Django 1.6 installed, it would prefer
that over Django 1.11, even if running on Python 3. This happened
because we explicitly tell it which version to import, and that was 1.6.
It would still try to load in Django 1.11 media, just through the 1.6
process.We also weren't using the right string types when manipulating the
environment. While not a huge problem in practice, in theory it could
cause issues.And finally, we weren't initializing the Django setup procedures when on
Django 1.11.This change fixes all that. We now set the desired Django version
depending on whether we're on Python 2.7 or 3.x. In time, this will be
the same version for both.It's important to note that this will not fix building static media
files. There are some huge differences between the media shipped by
Django 1.6 and 1.11, and this impacts our own media building in
significant ways. The work required to fix that is very much
in-progress. This change just fixes the initial start of the static
media building process.
Tested starting off the media building process on Django 1.6 and 1.11,
on Python 2.7 and 3.5-3.7.
Description | From | Last Updated |
---|---|---|
E402 module level import not at top of file |
reviewbot |