aaanand / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

REQUEST: WSGIPythonPath on Virtual Host context #305

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please make it possible for the WSGIPythonPath directive to be used inside a 
VirtualHost.

That will enable us to set custom module directories for each wsgi aplication, 
avoiding us the need to set it manually for every entry point.

Original issue reported on code.google.com by HRG....@gmail.com on 3 Sep 2013 at 3:22

GoogleCodeExporter commented 8 years ago
It is not possible because WSGI applications in different VirtualHost's can 
still run in the same interpreter context. Even if running in different 
interpreters, one cannot easily determine what interpreter it will be because 
the interpreter is selected dynamically on a per request basis.

What you should do is use separate mod_wsgi daemon process groups for each 
VirtualHost and delegate the WSGI applications using that to a separate set of 
processes. You can then set python-path option on WSGIDaemonProcess.

<VirtualHost *:80>
ServerName one.example.com

WSGIDaemonProcess server-1 display-name=%{GROUP} python-path=/some/path/one
WSGIProcessGroup server-1
WSGIApplicationGroup %{GLOBAL}

WSGIScriptAlias / /some/path/app.wsgi
</VirtualHost>

<VirtualHost *:80>
ServerName one.example.com

WSGIDaemonProcess server-2 display-name=%{GROUP} python-path=/some/path/one
WSGIProcessGroup server-2
WSGIApplicationGroup %{GLOBAL}

WSGIScriptAlias / /some/path/app.wsgi
</VirtualHost>

Using daemon mode is a safer and better option anyway.

For more information see:

http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daem
on_Process
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Defining_Process_G
roups
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIProcessGroup

Original comment by Graham.Dumpleton@gmail.com on 3 Sep 2013 at 3:30

GoogleCodeExporter commented 8 years ago

Original comment by Graham.Dumpleton@gmail.com on 3 Sep 2013 at 3:30

GoogleCodeExporter commented 8 years ago
Many thanks!

Original comment by HRG....@gmail.com on 3 Sep 2013 at 5:19