Question

I have a little project created with django1.3 and I want to migrate it to django1.4 but since the files structure change a little, what is the best way to migrate?

Was it helpful?

Solution

Read https://docs.djangoproject.com/en/dev/releases/1.4/ first.

  • For a quick run, just update env from Django1.3 to 1.4, tweak settings file and project code by fixing any incompatibility warning and imports issue.
  • For a clean update, better to create an empty project w/ the same name of the current project and migrate it w/ current code, mainly override foo/settings.py and foo/urls.py . I prefer to follow settings structure by http://justcramer.com/2011/01/13/settings-in-django/ , when it's done there is no need to merge base settings.py each time you update Django version.

OTHER TIPS

Regarding directory structure, I think all you have to do is move your manage.py one level up and change it's contents to this(replacing {{project_name}} with the name of your project):

#!/usr/bin/env python
import os, sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

Look here for details: https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top