Replaced hardcoded paths with calls to url_for(). Adds support to serve ...

...the app from a subdirectory