6

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?

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I can confirm this is impossible. My server is running mezzanine cms with python 2. I was trying to deploy other cms - djangcms - with python3 and it was unable to run.
1

Yes, this is possible as far as you are using virtual environment.

Please refer this : https://pypi.org/project/mod-wsgi/

After following these steps you may need to use ProxPass in your apache config file.

For that follow this : Apache redirect to another port

1 Comment

Self contained answer would be better than links as links could die in the future
-1

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.

2 Comments

Many thanks, that's great to know. However, although I can see I can have links to different .wsgi scripts in this way, I'm still a little confused about how mod_wsgi is added to Apache. If I've understood correctly (and I may not have done!), then mod_wsgi itself needs to be compiled for either python 2 or python 3. Is that correct? And if so, does that mean I somehow need to have 2 versions of mod_wsgi installed? Can I do that using virtualenv too?
Virtualenv won't be enough, as mod_wsgi is compiled either for Python2 or Python3, but cannot work with both. The location of Python does not matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.