问题
I already have a web application in written in Python 2 that runs over WSGI (specifically, OpenERP web server).
I would like to write a new web application that would run on the same server (Apache 2 on Ubuntu), but using WSGI and Python 3. The two applications would be on different ports.
Is that possible?
回答1:
No, it is not possible with mod_wsgi (see here: https://github.com/GrahamDumpleton/mod_wsgi/issues/21 and here: https://serverfault.com/questions/599859/multiple-python-versions-under-apachemod-wsgi)
This post also provides an alternative: using nginx.
回答2:
Its quite possible. This is what virtualenv as all about. Set up the second app in a virtualenv , with python3 .
You an add it in a virtualhost configuration in apache.
来源:https://stackoverflow.com/questions/14375520/wsgi-apps-with-python-2-and-python-3-on-the-same-server