问题
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?
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/9857364/whats-is-the-best-way-to-migrate-folder-and-files-structure-from-django1-3-to-dj