Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Updated README to reflect non-intuitive upgrade path
Browse files Browse the repository at this point in the history
If upgrading from a < Django 1.4 project and you choose
to update the directory structure, developers will need
to ensure they remove the __init__.py file so that the
project is not interpreted as a python package by Nose.
  • Loading branch information
ashchristopher committed Jul 12, 2012
1 parent 5951b88 commit c3d045d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@ added to the Nose test runner.

Older Versions of Django
------------------------
Upgrading from Django <= 1.3 to Django 1.4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In versions of Django < 1.4 the project folder was infact a python package as
well (note the __init__.py in your project root). In Django 1.4, there is no
such file and this the project is not a python module.

**When you upgrade your Django project to the Django 1.4 layout, you need to
remove the __init__.py file in the root of your project (and move any python
files that reside there other than the manage.py) otherwise you will get a
`ImportError: No module named urls` exception.**

This happens because Nose will intelligently try to populate your sys.path, and
in this particular case includes your parent directory if your project has a
__init__.py file (see: https://github.com/nose-devs/nose/blob/release_1.1.2/nose/importer.py#L134).

This means that even though you have set up your directory structure properly and
set your `ROOT_URLCONF='my_project.urls'` to match the new structure, when running
django-nose's test runner it will try to find your urls.py file in `'my_project.my_project.urls'`.




Upgrading from Django < 1.2
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit c3d045d

Please sign in to comment.