You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked for solution to distinguish 2 opensubmit instances (separate urls) to select the right configuration ini file in settings.py. A possible solution in combination with wsgi is to have separate wsgi.py and set an environment variable, which can be read in settings.py.
wsgi.py:
os.environ["DJANGO_SETTINGS_MODULE"]= "opensubmit.settings"
os.environ["SUBMIT_INI"]="/etc/opensubmit/settings_1.ini" # use separate configfiles in the wsgi.py
settings.py:
instance=os.environ.get("SUBMIT_INI",'/etc/opensubmit/settings.ini') #multi instance setup
config_info = (
(instance, True), # Linux production system
What I thought was a webserver variable (SetEnv in apache2) identifying the instance and that can be read in settings.py, but that seems not be portable between webservers.
Is there a more elegant solution? Proposals?
The text was updated successfully, but these errors were encountered:
All web applications struggle with that issue. There are tons of solutions - config data in the database, config data in the web folders, config data based on environment variables, config data based on files linked by environment variables. All approaches have their pros and cons.
The main issue is to pass the environment variable through WSGI. The best solution I could find is this one:
You basically abuse the WSGIProcessGroup identifier to find the name of the right config file. They could still all live in /etc/opensubmit/ with that approach.
I looked for solution to distinguish 2 opensubmit instances (separate urls) to select the right configuration ini file in settings.py. A possible solution in combination with wsgi is to have separate wsgi.py and set an environment variable, which can be read in settings.py.
wsgi.py:
settings.py:
What I thought was a webserver variable (SetEnv in apache2) identifying the instance and that can be read in settings.py, but that seems not be portable between webservers.
Is there a more elegant solution? Proposals?
The text was updated successfully, but these errors were encountered: