Improving the add-ons generator to deal with apps (bug 1080145)

Cancel and replace PR#320
How about a `if not settings.DEBUG: raise...` at the beginning? This way you fail earlier, and you have one less indent ;)