I am trying to add WSGIPythonPath
in VirtualHost
but it\'s throwing me an error:
Syntax error on line 549 of /etc/httpd/conf/httpd.
I had a difficult journey setting up two virt. hosts with Apache mod_wsgi under Windows. So the solution here is for Apache/mod_wsgi and Windows.
In general I find it quite difficult to seperate Apache/mod_wsgi for windows and unix as in many articles the two are mixed or it is not clearly mentioned at all which one is being talked about.
<VirtualHost *:80>
ServerName name1
WSGIScriptAlias / "D:/....../wsgi.py" application-group=site1
......
</VirtualHost>
<VirtualHost *:80>
ServerName name2
WSGIScriptAlias / "D:/....../wsgi.py" application-group=site2
......
</VirtualHost>
If you do not add "application-group..." only the virtual host that is first called after Apache restart will initialize with wsgi.py and settings.py and afterwards will get all requests to virt. hosts that have a WSGIScriptAlias or in other words that are handled by mod_wsgi!! To my understanding this is a rather serious bug because a virt host should always get his own "thread" as standard behavior of Apache/mod_wsgi. Btw Site1 and Site2 are just names that must be different.
sys.path.append('D:/........../xxxxx_project/xxxxx')
os.environ['DJANGO_SETTINGS_MODULE'] = 'xxxxx.settings'
application = get_wsgi_application()