Application factory cleanup

* Cleanup Flask application factory to make application
  assembly more clear.
Package order aware template loading

* Adds Jinja2 template loader that respect template loading
  order according to the PACKAGES configuration. This is needed
  for overlays like Inspire and Zenodo to customize e.g.
  'page.html'.
template: fix jinja loader order awareness