Skip to content
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

Upgrade to Django 1.9/1.10 #103

Closed
dennissiemensma opened this issue Mar 23, 2016 · 7 comments
Closed

Upgrade to Django 1.9/1.10 #103

dennissiemensma opened this issue Mar 23, 2016 · 7 comments
Assignees
Milestone

Comments

@dennissiemensma
Copy link
Member

dennissiemensma commented Mar 23, 2016

I want to upgrade to the latest Django, because this project was all about learning in the first place. And I do not need to use an LTS release, since most users run the app in their own private network.

https://docs.djangoproject.com/en/1.9/releases/1.9/

"The Django 1.8 series is the last to support Python 3.2 and 3.3."

Which is fine, so I can drop support for those.

"Added the date lookup to DateTimeField to allow querying the field by only the date portion."

One of the features I was really looking forwad to, as I now have to perform those actions either raw or with a hack or something.

"Time lookups (hour, minute, second) are now supported by TimeField for all database backends. Support for backends other than SQLite was added but undocumented in Django 1.7."

Might be interesting.

"Database configuration gained a TIME_ZONE option for interacting with databases that store datetimes in local time and don’t support time zones when USE_TZ is True."

Could be a solution for MySQL users, as the database might lose some offset-accuracy at the moment.

"The dumpdata command output is now deterministically ordered. Moreover, when the --output option is specified, it also shows a progress bar in the terminal."

Not something I need, but it's still cool.

And ofcourse many, many more features.

@dennissiemensma dennissiemensma added this to the 1.0.0 milestone Mar 23, 2016
@dennissiemensma dennissiemensma modified the milestones: 1.1.x, 1.0.0 Mar 23, 2016
@dennissiemensma
Copy link
Member Author

More packages outdated already as well. (just updated them a week ago)
https://requires.io/github/dennissiemensma/dsmr-reader/requirements/?branch=master

@dennissiemensma
Copy link
Member Author

The only downside is that mainstream support ends in four months.
https://www.djangoproject.com/download/#supported-versions

I think it would be better to migrate directly from 1.8 through 1.9 to 1.10 in August.

@dennissiemensma dennissiemensma changed the title Upgrade to Django 1.9.x Upgrade to Django 1.9/1.10 Apr 6, 2016
@dennissiemensma dennissiemensma modified the milestones: 1.4.x, 1.1.x Apr 6, 2016
@dennissiemensma dennissiemensma modified the milestones: 1.4, 1.5 Nov 7, 2016
@dennissiemensma
Copy link
Member Author

@dennissiemensma
Copy link
Member Author

Changes in dsmrreader due to Django 1.9

  • Dropped Python 3.3 support (Travis tests are optional/may fail).

  • Removed django-flat-theme, since that project was merged into Django 1.9 natively.

  • Replaced login_required decorators with the new builtin LoginRequiredMixin.

  • I won't be able to use the new --parallel option for tests, but I did find pytest-xdist which does the same.
    -- Does not seem to work on MySQL (need separate databases).
    -- Postgres tests: 12.92s -> 8.40s
    -- SQLite tests: 9.90s -> 4.94s
    -- It looks small, but especially the SQLite's 5 seconds shave off is welcome, as that is my primary development runsuite.

  • The parallel tests exposed a weakness in the file-based caching backend I choose, so now I switched to Django's LocMemCache for the future releases.

  • Renamed postgresql_psycopg2 DB backend to postgresql (the old one is now an alias since 1.9). Does not affect anything, just for consistency.

  • Dropped model_meta_info template tag (my own one), which was still a left over of v1.4 refactoring.

  • Due to a change in Django's compilemessages command, I had to edit some PO-files located in the docs-folder. Django 1.9 also takes those into account and there was something the builtin msgfmt module/method was complaining about.

Builds pass as well: https://travis-ci.org/dennissiemensma/dsmr-reader/builds/179857305

@dennissiemensma
Copy link
Member Author

Changes in dsmrreader due to Django 1.10:

  • After installing Django 1.10 almost all tests failed instantly, due to a ensure_not_cyclic() check of Django. The same applies for the runserver command. It seems to be caused by the squashed migrations in Squash migrations #31. And since they were introduced a long time ago in dsmrreader v0.13 (β), I should be able to remove them. Only users running v0.12 (β) or before will be affected. They would have to upgrade in two steps (-> v1.4 -> v1.5).

Django instructions @ https://docs.djangoproject.com/es/1.9/topics/migrations/#squashing-migrations:

You must then transition the squashed migration to a normal migration by:

- Deleting all the migration files it replaces.

- Updating all migrations that depend on the deleted 
migrations to depend on the squashed migration instead.

- Removing the replaces attribute in the Migration class of 
the squashed migration (this is how Django tells that it is a squashed migration).

I will post a warning in the v1.5 release notes as well.

  • Replaced some references to Model._meta.get_all_field_names() with [x.name for x in Model._meta.get_fields()]. It was deprecated in Django 1.9, and I fixed one during the 1.9 upgrade, but forgot two others, which now crash in Django 1.10.

Builds pass here as well: https://travis-ci.org/dennissiemensma/dsmr-reader/jobs/179873741

@dennissiemensma
Copy link
Member Author

Merged to development, but I'll just have to run it on my production to be sure that it still ticks as expected.

@dennissiemensma
Copy link
Member Author

Deployed and seems to work well. Processes run and readings are taken. The web interface is running as well.

I think can be marked completed for now. If something breaks I'll reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant