Make 'debug mode' switch work

Switching off debug mode lets you upload straight to Commons for real.
Also, debug mode now uses test.wikipedia.org.
Consolidated API initialization into [app startApi].