Setting JINJA_ENVIRONMENT in router.custom_dispatcher function