Oli
Oli

Reputation: 239810

Is there a quick way to automatically update a Django project to the next major version?

So Django 1.5 will be out within an Internet-Week (soon) and I'm feeling the pressure to start playing around with it for its vastly improved User model. But like with 1.4 and 1.3 before it, upgrading is not simply a virtualenv change, I've needed to alter (quite heavily in places) the structure of my projects.

I recently jumped from 1.2 to 1.4 and spend hours (over many projects) updating their file structures (and settings) to mirror modern Django preferences. Django 1.5 is going to force me to go through and fix all the CACHE settings and fix practically every instance of {% url ... %} in my templates.. I'm wondering if there's an easier way.

Is there anything out there that can automagically "upgrade" a Django project?

... Or at the very least "scan" a project to show up the larger honking issues so I can kick those out before starting QC.

Upvotes: 6

Views: 282

Answers (1)

Jack Shedd
Jack Shedd

Reputation: 3531

No. And for good reason.

Some of the changes between versions are minor (such as the whole quotes around variables thing), while some are major (like the new User model).

While automatic detection might be possible (though non-trivial considering you'd have to execute every possible code path in the app), changing them would be fragile. And possible very dangerous.

Instead, when moving between versions, I move up one version (to the last minor version in for that major) at a time and test. Django will issue warnings for features that will be removed between versions, so it's easy to catch them while still having running code that works.

Upvotes: 1

Related Questions