Use proper mechanism for URL prefix

* Set APPLICATION_ROOT
* Use url_for to resolve URLs