from flask import Response @app.route('/ajax_ddl') def ajax_ddl(): xml = 'foo' return Response(xml, mimetype='text/xml')