I have a Database hosted on a private server which I am using to interact with a frontend website. To access the database my IP needs whitelisting. My website is hosted on Heroku and it's IP's are not static, so I've configured it to take all traffic via a proxy server which does have a static IP.
In setting my database connection via SQLAlchemy, I need to tell it to go via the proxy address. Is there a way to configure this?
I tried:
proxy = "..."
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy
app = Flask(__name__)
app.config['SECRET_KEY'] = '....'
app.config['SQLALCHEMY_DATABASE_URI'] = f'mysql://{USER}:{PASS}@{HOST}:{PORT}/{DB}'
.......
db = SQLAlchemy(app)
Getting connection time out when live in production.
Can SQLAlchemy library deal with setting proxy's? I've looked through documentation and cannot find anything. Maybe there is a trick I'm missing?