Dash now follows Flask in providing a
static_folderdefault ofstaticwhich means it’s enough to create your Dash instance and then create astaticfolder in the same directory as your Dash app and it should just work out of the box:
The problem of the solution is it serves assets as “www.example.com/static/ads.txt”.
I needed to serve my file on root as “www.example.com/ads.txt”
So I copied code from Allowing users to download CSV on click - #3 by scottschmidt
import flask
@app.server.route("/ads.txt")
def serve_static():
return flask.send_file("./static/ads.txt", mimetype="text")
Looks this is working …