Assuming your substitutions are in replace.txt, in conf. py write
rst_epilog = open("replace.txt", "r").read()
or
rst_prolog = open("replace.txt", "r").read()
Since I use the same replace.txt for different projects, I have a slight different definition of rst_epilog, which I report in case someone finds it useful.
rst_epilog = """
.. |product| replace:: %s
.. |company| replace:: %s
""" % (project, comp) + open("replace.txt", "r").read()
Here, project and comp are variables defined in conf.py that vary with the project I am working on.
HTH,
Stefano