Setup the plugin from an application.

def setup(self, app):
        """ Setup the plugin from an application. """
        super().setup(app)

        if isinstance(self.cfg.template_folders, str):
            self.cfg.template_folders = [self.cfg.template_folders]

        else:
            self.cfg.template_folders = list(self.cfg.template_folders)

        self.ctx_provider(lambda: {'app': self.app})
        self.env = Environment(debug=app.cfg.DEBUG, **self.cfg)