mod_wsgi
mod_wsgi copied to clipboard
Two django projects but always the first is accessible
I have two django projects deployed under apache(On Windows). Project A => 127.0.0.1:91 Project B =: 127.0.0.1.92
My httpd.conf file
LoadFile "C:/Python/Python310/python310.dll"
LoadModule wsgi_module "C:/Users/luqman/.virtualenvs/fuel_delivery-2XkG-XG1/lib/site-packages/mod_wsgi/server/mod_wsgi.cp310-win_amd64.pyd"
WSGIPythonHome "C:/Users/luqman/.virtualenvs/fuel_delivery-2XkG-XG1"
LoadFile "C:/Python/Python310/python310.dll"
LoadModule wsgi_module "C:/Users/luqman/.virtualenvs/customer_portal-wB0D-mKm/lib/site-packages/mod_wsgi/server/mod_wsgi.cp310-win_amd64.pyd"
WSGIPythonHome "C:/Users/luqman/.virtualenvs/customer_portal-wB0D-mKm"
My httpd-vhosts.conf file
PROJECT A
Listen 127.0.0.1:91
<VirtualHost 127.0.0.1:91>
ServerAdmin [email protected]
ServerName portal.localhost:91
ServerAlias portal.localhost
WSGIPassAuthorization On
ErrorLog "logs/portal_error.log"
CustomLog "logs/portal_access.log" common
WSGIScriptAlias / "D:/projects/customer_portal/portal/wsgi_windows.py" application-group=%{GLOBAL}
<Directory "D:/projects/customer_portal/portal">
<Files wsgi_windows.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Project B
Listen 127.0.0.1:92
<VirtualHost 127.0.0.1:92>
ServerAdmin [email protected]
ServerName fuel.localhost:92
ServerAlias fuel.localhost
WSGIPassAuthorization On
ErrorLog "logs/fuel_delivery_error.log"
CustomLog "logs/fuel_delivery_access.log" common
WSGIScriptAlias / "D:/projects/fuel_delivery/config/wsgi_windows.py" application-group=%{GLOBAL}
<Directory "D:/projects/fuel_delivery/config">
<Files wsgi_windows.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
When I call 127.0.0.1:91(Project A) I got expected project but when I call 127.0.0.1:92 it returns Project A How can deploy two different projects from on apache server????
Read:
- http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html
Windows isn't really a great platform for running multiple sites as daemon mode of mod_wsgi is not available. That said, if you fix up how DJANGO_SETTINGS_MODULE
is set as explained in that post, you may still manage to get it working.
I solved that issue under Windows (because for that specific project changing to Ubuntu was not a solution) by using always an individual name for application-group like
virt-host 1: application-group=app_name_1 ...
virt-host 2: application-group=app_name_2
I do not know if there is other (performance?) consequences but the server is running meanwhile since a long time without any issue but with very low traffic only!!