Migrating older 1.4 project to 1.9

92 views
Skip to first unread message

Roger Dunn

unread,
Mar 29, 2016, 5:19:59 PM3/29/16
to Django users
I've inherited a moderately large project written 2 years ago using Django 1.4, and wondering if it is worth creating a fresh 1.9 project and porting in the old code, or doing an in-place upgrade to 1.9?

I have it running on 1.4 'as is' but if I run python manage.py migrate it comes unglued as a lot of stuff has changed since 1.4.



Tim Graham

unread,
Mar 29, 2016, 8:13:23 PM3/29/16
to Django users
We recommend going one major version at a time: https://docs.djangoproject.com/en/stable/howto/upgrade-version/

bobhaugen

unread,
Mar 30, 2016, 9:23:15 AM3/30/16
to Django users
We feel your pain. If you do it, and write down how it goes, we would be grateful.

Fred Stluka

unread,
Mar 30, 2016, 10:08:26 AM3/30/16
to django...@googlegroups.com
Roger,

Yeah, I too have a large project that I'll hopefully be migrating
from 1.4 to 1.9 soon.

It's about 3.5 years worth of work, over 200,000 lines of code
in about 1000 Python source file and Django template files.

So any tips you come up with will be invaluable.  Please post
anything you learn to this thread.

Thanks!
--Fred
Fred Stluka -- mailto:fr...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2a3de1fc-5032-4807-b008-66f2e381ac7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gergely Polonkai

unread,
Mar 30, 2016, 2:09:35 PM3/30/16
to Django users

I have already suggested this approach to someone with a similar problem: upgrade one version at a time. I’m sure it is possible to find older versions; 1. upgrade to the next minor release (1.4 => 1.5, etc), 2. do the necessary adjustments, 3. goto 1.

It may be a lot of work, but at the end of the day you will have a perfectly upgraded application. I have successfully upgraded 3 apps this way, one of them being really big (tens of thousands of code lines).

Kristofer Pettijohn

unread,
Mar 30, 2016, 8:17:41 PM3/30/16
to django...@googlegroups.com
I have also upgraded a few apps this way, from 1.5 to 1.9.  Keep your eyes on the release notes for each version for big changes.  It also helps to have good test cases written so that you can run them upon each upgrade.


From: "Gergely Polonkai" <ger...@polonkai.eu>
To: "Django users" <django...@googlegroups.com>
Sent: Wednesday, March 30, 2016 1:06:45 PM
Subject: Re: Migrating older 1.4 project to 1.9

Source3Computing

unread,
Apr 2, 2016, 9:37:21 AM4/2/16
to Django users
As stated above, take small steps.  Take the time to read the release notes for each minor version.  Most of the minor versions are bug fixes and you can scan through them.
 
Pay close attention to migrations if using South.  In Django 1.7 South is not used.  Django incorporated migrations into the core code.  In Django 1.6 you will add code to settings.py to prepare you for Django 1.7 migration format (if using south).  Each third-party installed app will also have specific requirements if upgrading from South.  Read the docs for each installed app.

I am in the process of updating four Django 1.5.5 / DjangoCMS 2.4.3 applications.  It is a painful time consuming process. I am documenting what I am doing to publish for others but it seams each application has its own upgrade propblems.

Larry Martell

unread,
Apr 2, 2016, 9:02:54 PM4/2/16
to django...@googlegroups.com
On Wed, Mar 30, 2016 at 10:07 AM, Fred Stluka <fr...@bristle.com> wrote:
> Roger,
>
> Yeah, I too have a large project that I'll hopefully be migrating
> from 1.4 to 1.9 soon.
>
> It's about 3.5 years worth of work, over 200,000 lines of code
> in about 1000 Python source file and Django template files.
>
> So any tips you come up with will be invaluable. Please post
> anything you learn to this thread.

What's prevented me from migrating past 1.6 is that in my apps I
import models in the top-level __init__.py, which is no longer
supported and now everything fails with "Apps aren't loaded yet".
Getting past that will require a major rewrite of the app, so
unfortunately we may just stay on 1.6 forever. We just don't have the
time or manpower or money for doing it.

Mike Dewhirst

unread,
Apr 3, 2016, 2:52:53 AM4/3/16
to django...@googlegroups.com
On 3/04/2016 11:01 AM, Larry Martell wrote:
> On Wed, Mar 30, 2016 at 10:07 AM, Fred Stluka <fr...@bristle.com> wrote:
>> Roger,
>>
>> Yeah, I too have a large project that I'll hopefully be migrating
>> from 1.4 to 1.9 soon.
>>
>> It's about 3.5 years worth of work, over 200,000 lines of code
>> in about 1000 Python source file and Django template files.
>>
>> So any tips you come up with will be invaluable. Please post
>> anything you learn to this thread.
>
> What's prevented me from migrating past 1.6 is that in my apps I
> import models in the top-level __init__.py, which is no longer
> supported

When you say "top-level" what do you mean?

I import models in the top level of each app so I can say "from app
import this, that, other" and it works fine. Django 1.8.

Mike

Larry Martell

unread,
Apr 3, 2016, 10:59:47 AM4/3/16
to django...@googlegroups.com
On Sun, Apr 3, 2016 at 2:52 AM, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> On 3/04/2016 11:01 AM, Larry Martell wrote:
>>
>> On Wed, Mar 30, 2016 at 10:07 AM, Fred Stluka <fr...@bristle.com> wrote:
>>>
>>> Roger,
>>>
>>> Yeah, I too have a large project that I'll hopefully be migrating
>>> from 1.4 to 1.9 soon.
>>>
>>> It's about 3.5 years worth of work, over 200,000 lines of code
>>> in about 1000 Python source file and Django template files.
>>>
>>> So any tips you come up with will be invaluable. Please post
>>> anything you learn to this thread.
>>
>>
>> What's prevented me from migrating past 1.6 is that in my apps I
>> import models in the top-level __init__.py, which is no longer
>> supported
>
>
> When you say "top-level" what do you mean?
>
> I import models in the top level of each app so I can say "from app import
> this, that, other" and it works fine. Django 1.8.

In my app's top level there is an __init__,py that imports modules
that import modules that import models.

I am assuming this is my issue:
https://docs.djangoproject.com/en/1.9/ref/applications/#how-applications-are-loaded

Mike Dewhirst

unread,
Apr 3, 2016, 7:32:23 PM4/3/16
to django...@googlegroups.com
On 4/04/2016 12:58 AM, Larry Martell wrote:
>> I import models in the top level of each app so I can say "from app import
>> >this, that, other" and it works fine. Django 1.8.

The above is wrong. I don't import models at the top level of each app.
In fact I import them at the top of each models module - in other words
in ...

<app>/models/__init__.py

... which appears to satisfy the Django loading sequence mentioned in
the docs to which you refer in the link below.

Sorry for misleading.

Mike

Larry Martell

unread,
Apr 4, 2016, 9:16:46 AM4/4/16
to django...@googlegroups.com
On Sun, Apr 3, 2016 at 7:31 PM, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> On 4/04/2016 12:58 AM, Larry Martell wrote:
>>>
>>> I import models in the top level of each app so I can say "from app
>>> import
>>> >this, that, other" and it works fine. Django 1.8.

Please watch your attribution. I did not write that, you did.

Mike Dewhirst

unread,
Apr 4, 2016, 7:50:56 PM4/4/16
to django...@googlegroups.com
Larry

I saw that after I sent it and thought .. just as well I signed my name
after the apology.

Mike
Reply all
Reply to author
Forward
0 new messages