> On 12 Feb 2018, at 9:50 pm, Angela Feliu <afel...@gmail.com> wrote: > > Hello everyone, > I'm trying to deploy a django application in two diferent alias to use > different settings file in each alias. > > Is it possible or I have to duplicate my app to execute two diferent apps > with different settings files
You should use daemon mode of mod_wsgi. Define two daemon process groups, one for each instance. Instead of pointing at the wsgi.py file, create two new files, one for each instance in same directory, thus wsgi_site1.py and wsgi_site2.py. In each you would have something like: import os os.environ['DJANGO_SETTINGS_MODULE'] = 'projectname.settings_site1' from projectname.wsgi import application Change 'settings_site1' in second to be 'settings_site2'. Make sure that the original wsgi.py was using original setdefault() method of updating os.environ, not [], so that the DJANGO_SETTINGS_MODULE in these wrappers take precedence. Then have the two WSGIScriptAlias as: WSGIDaemonProcess site1 python-path=/some/path WSGIDaemonProcess site2 python-path=/some/path WSGIScriptAlias /site1 /some/path/projectname/wsgi_site1.py process-group=site1 application-group=%{GLOBAL} WSGIScriptAlias /site2 /some/path/projectname/wsgi_site2.py process-group=site2 application-group=%{GLOBAL} To each WSGIDaemonProcess, add a python-home option with value which is the root of the Python virtual environment to use. Virtual environment setup instructions in: http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html <http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html> In short, you don't need to make a complete copy of your project code, just create two different WSGI script files which set DJANGO_SETTINGS_MODULE as necessary for that instance. I hope I understood properly what you are asking. Graham -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+unsubscr...@googlegroups.com. To post to this group, send email to modwsgi@googlegroups.com. Visit this group at https://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.