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
general: fixes

* Attempts fixing login with no cache backend; login is still not finalized;
* Upgrades MySQL-python to 1.2.5 attempting to fix Travis issues.

Signed-off-by: Adrian-Tudor Panescu <adrian.tudor.panescu@cern.ch>