This directory 'campaigns' is like the django directory 'mysite'
mentioned in the tutorial. There are two installed apps in there.
The first, polls, is what you get if you work your way through the
tutorial, but decide that you want named urls, to use forms, to have a
static site, and to have a lot of integration tests written using
unittest -- and some unittests too, when I was able to figure out how.
It's mostly of use as a reference for how to do things, and because
when things aren't working it is nice to have an even smaller and more
basic app to try things out on.
One caveat, for people who are used to doing TDD. It seems that many
places in Django the design decision made was that it was better to
render something, even if you didn't ask for it properly, completely
silently. Users should never get error messages or warnings. And
probably that was a good decision for a newspaper. But it means that
you really have to keep eyeballing your pages and testing that they
are all working when you make changes, because they can and do break
silently. Your tests can keep passing while your pages lose
functionality because your url mappings didn't work as you expected.
If you start getting errors
NoReverseMatch: Reverse for <something> with arguments '()' and keyword
arguments <somedict> not found
then the first place to check is to see that the names you gave your
regexps in urls.py are the same names you referred to them in views.py.
to run tests, cd to campaigns and type:
python manage.py test numpy_on_pypy or use make test from the Makefile
For some reason, django wants your apps to live in <top_level_dir>/app
except for the templates, which live in <top_level_dir>/templates/app .
Sticking them under app as well seems a lot more reasonable to me. But
I am sticking with the given setup, given that I don't know why it is
that it is done that way, and if its essential for some behind-the-scenes
magic I am unaware of.