So I have a flask app running and this is how the config file looks like:
class config(object):
SECRET_KEY = 'india'
class configTest(config):
MYSQL_HOST = 'host1'
MYSQL_PORT = 3306
MYSQL_USER = 'admin'
MYSQL_PASSWORD = 'yangmai'
MYSQL_DB = 'ide'
class configProd(config):
MYSQL_HOST = 'host2'
MYSQL_PORT = 3306
MYSQL_USER = 'admin'
MYSQL_PASSWORD = 'yangmai'
MYSQL_DB = 'ide'
In my init.py, I do this:
app.config.from_object('project.config.configTest')
Works good. Now what I want is to give user the option to switch the db at the time of logging in. So essentially, the config class should change from configTest to configProd or vice versa as the user selects.
The idea is to give user the option to access the test and prod environments without deploying two separate apps. Any solutions? Also, the app is run by apache.