We're trying to run multiple apps in a single apache 2.2.14 server, with
the latest mod_wsgi 3.4.
Each app seems to work fine on it's own, but when running them both
seperately, we are having problems where some packages are leaking from one
apps virtual env into the other.
We have a baseline environment we set via WSGIPythonHome
> WSGIPythonHome /wsgi/shared/baseline_env/
>
We configure the apps like this:
# App A
>
> # The same process should host /root/foo/A, /root/bar/A, etc.
>
> WSGIDaemonProcess appA user=www-data group=www-data \
>
> python-path=/wsgi/shared/A/env/lib/python2.6/site-packages/ \
>
> display-name=%{GROUP}
>
> WSGIScriptAliasMatch ^/root/[^/]+/A /wsgi/shared/A/A.wsgi
>
> <Location /root/*/A>
>>
> WSGIProcessGroup appA
>
> WSGIApplicationGroup %{GLOBAL}
>
> </Location>
>
>
> # App B
>
> # The same process should host /root/foo/B, /root/bar/B, etc.
>
> WSGIDaemonProcess appB user=www-data group=www-data \
>
> python-path=/wsgi/shared/BA/env/lib/python2.6/site-packages/ \
>
> display-name=%{GROUP}
>
> WSGIScriptAliasMatch ^/root/[^/]+/B /wsgi/shared/B/B.wsgi
>
> <Location /root/*/B>
>>
> WSGIProcessGroup appB
>
> WSGIApplicationGroup %{GLOBAL}
>
> </Location>
>
>
In each wsgi file we are also using the suggested section to re-order the
packages:
> VENV_PATH = '/wsgi/shared/A/env/lib/python2.6/site-packages'
>
> # Remember original sys.path.
>
> prev_sys_path = list(path)
>
>
>
> # Add each new site-packages directory.
>
> addsitedir(VENV_PATH)
>
>
>
> # Reorder sys.path so new directories at the front.
>
> new_sys_path = []
>
> for item in list(path):
>
> if item not in prev_sys_path:
>
> new_sys_path.append(item)
>
> path.remove(item)
>
> path[:0] = new_sys_path
>
>
The last line of my wsgi file does this:
> from pyramid.paster import get_app, setup_logging
>
>
>
> setup_logging(INI_PATH)
>
> application = get_app(INI_PATH, INI_SECTION)
>
>
and I get intermittent error logs where sometimes app A uses B's version of
pyramid and errors out, and sometimes vice versa.
I wrote some logging code to verify what was happening with the path:
with open("/tmp/path_log.txt", "w") as f:
>
> f.write("Spinning up B app...\n")
>
> f.write("Original path:\n")
>
> for e in prev_sys_path:
>
> f.write(e + "\n")
>
>
>
> f.write("Current:\n")
>
> for e in path:
>
> f.write(e + "\n")
>
>
> E.g. This output shows B getting a correctly ordered path with it's
instance of pyramid above A's
> https://gist.github.com/anonymous/7ff0841a32bfdfe50818
>
and yet that was one of the times I got an error log saying it was trying
to use A's version of pyramid.
Any help would be appreciated
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.