Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to upgrade from Django 0.96 to 1.0?

Tags:

python

django

Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?

like image 380
pjz Avatar asked Sep 24 '08 17:09

pjz


3 Answers

Although this depends on what you're doing, most applications should be able to just upgrade and then fix everything that breaks. In my experience, the main things that I've had to fix after an upgrade are

  1. Changes to some of the funky stuff with models, such as the syntax for following foreign keys.

  2. A small set of template changes, most notably auto-escaping.

  3. Anything that depends on the specific structure of Django's internals. This shouldn't be an issue unless you're doing stuff like dynamically modifying Django internals to change their behavior in a way that's necessary/convenient for your project.

To summarize, unless you're doing a lot of really weird and/or complex stuff, a simple upgrade should be relatively painless and only require a few changes.

like image 180
Eli Courtwright Avatar answered Nov 19 '22 02:11

Eli Courtwright


Upgrade. For me it was very simple: change __str__() to __unicode__(), write basic admin.py, and done. Just start running your app on 1.0, test it, and when you encounter an error use the documentation on backwards-incompatible changes to see how to fix the issue.

like image 3
John Millikin Avatar answered Nov 19 '22 02:11

John Millikin


Just upgrade your app. The switch from 0.96 to 1.0 was huge, but in terms of Backwards Incompatible changes I doubt your app even has 10% of them.

I was on trunk before Django 1.0 so I the transition for me was over time but even then the only major things I had to change were newforms, newforms-admin, str() to unicode() and maxlength to max_length

Most of the other changes were new features or backend rewrites or stuff that as someone who was building basic websites did not even get near.

like image 2
Bart Avatar answered Nov 19 '22 02:11

Bart