upgrading.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Upgrading Django
  2. ================
  3. Upgrading from Django <= 1.3 to Django 1.4
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. In versions of Django < 1.4 the project folder was in fact a python package as
  6. well (note the __init__.py in your project root). In Django 1.4, there is no
  7. such file and thus the project is not a python module.
  8. **When you upgrade your Django project to the Django 1.4 layout, you need to
  9. remove the __init__.py file in the root of your project (and move any python
  10. files that reside there other than the manage.py) otherwise you will get a
  11. `ImportError: No module named urls` exception.**
  12. This happens because Nose will intelligently try to populate your sys.path, and
  13. in this particular case includes your parent directory if your project has a
  14. __init__.py file (see: https://github.com/nose-devs/nose/blob/release_1.1.2/nose/importer.py#L134).
  15. This means that even though you have set up your directory structure properly and
  16. set your `ROOT_URLCONF='my_project.urls'` to match the new structure, when running
  17. django-nose's test runner it will try to find your urls.py file in `'my_project.my_project.urls'`.
  18. Upgrading from Django < 1.2
  19. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. Django 1.2 switches to a `class-based test runner`_. To use django-nose
  21. with Django 1.2, change your ``TEST_RUNNER`` from ``django_nose.run_tests`` to
  22. ``django_nose.NoseTestSuiteRunner``.
  23. ``django_nose.run_tests`` will continue to work in Django 1.2 but will raise a
  24. warning. In Django 1.3, it will stop working.
  25. If you were using ``django_nose.run_gis_tests``, you should also switch to
  26. ``django_nose.NoseTestSuiteRunner`` and use one of the `spatial backends`_ in
  27. your ``DATABASES`` settings.
  28. .. _class-based test runner: http://docs.djangoproject.com/en/dev/releases/1.2/#function-based-test-runners
  29. .. _spatial backends: http://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#id1
  30. Django 1.1
  31. ~~~~~~~~~~
  32. If you want to use django-nose with Django 1.1, use
  33. https://github.com/django-nose/django-nose/tree/django-1.1 or
  34. http://pypi.python.org/pypi/django-nose/0.0.3.
  35. Django 1.0
  36. ~~~~~~~~~~
  37. django-nose does not support Django 1.0.