Rely on more Python and less on mako, setup a small shared common mako file in config/plugins/interactive_environments/common/ie.mako. Move ie.js into client/galaxy/scripts/galaxy.interactive_environments.js and extract IPython's require config out so it doesn't have to directly reference client/galaxy/scripts/galaxy.interactive_environments.js (I doubt it is where that file actually should be).