Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Django Upgrade #3123
Upgrades Django to latest long term supported version for security patches. This is the last version of Django to support Python 2.
There are two known issues with the upgrade that were not resolved, and have been extracted into their own cards:
The Swagger update is higher priority, since currently our API docs are broken. The verbose logging is a minor annoyance. The Celery Loop is hard to recreate, but could hold up workers in production if happening consistently.
This is the latest stable version that supports Python 2.7. Also upgrade some supporting libraries.
This is the last version that supports Python 2.7. All serializers need an explicit field list now, so that is added wherever it was missing. Extraneous serializers that were not used anywhere were removed. Read-only complex serialized fields now need explicit code to save in new instances, so that is also added.
Change to the new version of using the app by adding to the THIRD_PARTY_APPS list and replacing the now deprecated GeoModelSerializer with a regular ModelSerializer.
- Replace render_to_response with render - Move custom context processor to be within template - Ensure context variables are always defined and have defaults - Use == instead of = for equality test within template - Use new TEMPLATES configuration setting rather than the separate TEMPLATE_CONTEXT_PROCESSORS, TEMPLATE_LOADERS, etc
I don't have all the data loaded yet, but I'm seeing this error when analyze is kicked off and jobs are polled.
This happens for all of the analyze components.
The celery jobs for each component however, appear to be working.
When clicking "I'll do this later" on the profile information modal, I got the following error:
request.body is now a stream instead of a variable, and its value is read somewhere up the chain, thus it can't be read again at this point. We switch to request.data instead, which is already a dict, thus supplanting the json.loads. Also don't modify request.data, instead make a copy and modify that, since request.data is now immutable.
Previously, all ForeignKey and OneToOne fields implicitly assumed on_delete to be CASCADE. Now this specification is required to be explicit. All models are upgraded to have on_delete specified in their ForeignKey and OneToOne fields. In most cases, we stick with the default CASCADE behavior. The exceptions are: - The User field on Project is set to PROTECT. This is to prevent the accidental deletion of projects if a user is deleted. To delete a user, their projects must be deleted manually. - The Mapshed_Job and Subbasin_Mapshed_Job fields on Project are set to SET_NULL. This is to allow the recalculation of Mapshed and Subbasin values for a project without deleting the project itself. - The User field on Job is set to SET_NULL. This is because the field already allows NULLs, and having historic job records may be useful even when there's no associated user. New migrations were created to specify these constraints explicitly. Furthermore, existing migrations were manually updated to also have the same constraints. This will have no impact on production, since existing migrations will not be re-run. This does help pacify the deprecation warnings that Django generates.
For live tests that exercise direct endpoints, use reverse rather than a full URL. Also use django.test.Client instead of requests. The test Client's response.url is now a relative URL, not an absolute one. Remove the extraction code which is not needed anymore. The test Client also doens't use the params= argument anymore. Switch to giving it the request body directly.
Getting some 500s from a few Monitor detail related fetches. Used a "sediment" search around Philly to get to this site.
Update: This happens on production, too so is likely an unrelated error
Since we're not using Upstart for scripts anymore, going with systemd instead, we have to use `sudo service` instead of `sudo start`.
The endpoint these tests were inspecting do not require CSRF protection, thus to test for it was extraneous. Since the upgrade, the tests began to fail as they would always return correct values. Since the tests are no longer necessary, they are removed.