import os.path from .utils import custom_settings from flask import Flask, send_from_directory app = Flask(__name__) @app.route('/logs/<jobid>/<podid>/<fname>', methods=['GET']) def get_log(jobid, podid, fname): fpath = os.path.join(custom_settings['scrapyd_logs_dir'], jobid, podid) return send_from_directory(fpath, filename=fname, as_attachment=True) if __name__ == '__main__': app.run(host="0.0.0.0", port=5000)