With Flask, how can I serve robots.txt and sitemap.xml as static files? [duplicate]
Put robots.txt and sitemap.xml into your app’s static directory and define this view: from flask import Flask, request, send_from_directory @app.route(‘/robots.txt’) @app.route(‘/sitemap.xml’) def static_from_root(): return send_from_directory(app.static_folder, request.path[1:])