Multiple versions of python on linux server

64 views
Skip to first unread message

robert brook

unread,
Nov 3, 2014, 10:46:51 AM11/3/14
to django...@googlegroups.com
This is the first time that I am having apache configured to run django

I plan on using mod_wsgi on apache and linux  using 2 servers, the apache server and the application server.

The linux (red hat 6) / django server had python 2.6 installed for admin purposes out of the box..
Go figure, 2.6 has to be 10 years old.

When you type in python,  the 2.6 version runs.

We added python 3.3 to install all of the packages to run the application.

I am able to launch the local dev server with python 3.3 after running a script to initiate python 3.3

I will have apache point to the wsgi.py file for the django application.
But how will apache know to implement python3.3

If I am missing something let me know, I am new at this production implementation.

Thanks




Andreas Kuhne

unread,
Nov 3, 2014, 10:57:47 AM11/3/14
to django...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2304dc16-31da-4fcd-bec5-d8e807b4b4d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Robert,

You should look into virtual environments. That way you can get a python 2.6, 2.7, 3.3 or 3.4 environment running without any problems. Check out: http://docs.python-guide.org/en/latest/dev/virtualenvs/.

When you have a working environment, you just have to activate it before you start the mod_wsgi instance, check: https://code.google.com/p/modwsgi/wiki/VirtualEnvironments

Regards,

Andréas

robert brook

unread,
Nov 3, 2014, 11:07:36 AM11/3/14
to django...@googlegroups.com
Thanks  I think this is the correct track.

I do not have the luxury to create a virtual environment because of the constraints of this organization.

But I see from the documentation link that you sent me that I can define something along these lines

"Once the baseline Python environment has been created, the WSGIPythonHome directive should be defined within the global part of the main Apache configuration files.

WSGIPythonHome /usr/local/pythonenv/BASELINE   "

Where do I place this directive in Apache and can you give me an example of the anything else that would be in this directive?

Thanks

Tim Chase

unread,
Nov 3, 2014, 11:21:50 AM11/3/14
to django...@googlegroups.com
On 2014-11-03 08:07, robert brook wrote:
> I do not have the luxury to create a virtual environment because of
> the constraints of this organization.

Just making sure that you're aware of the difference between a
virtual environment and a virtual machine.

A virtual machine is a full abstraction of the hardware and it's
entirely likely that your IT department would impose constraints on
their creation & management.

A virtual *environment* is just a local directory created & populated
with the standard Python "virtualenv" utility, and the setting of a
few environmental variables (done in the WSGI configuration). It
seems odd that an IT department would be so fascist as to limit the
creation & population of a folder on an existing machine.

-tkc




robert brook

unread,
Nov 3, 2014, 11:31:04 AM11/3/14
to django...@googlegroups.com, django...@tim.thechases.com
I understand the difference between a virtual machine and a virtual environment (of which I can have 0 - many environments  on one virtual machine).

Since I do not have conflicts in packages and am only using python 33 for the django packages, the 2 environments act as if they were 2 virtual machines.
Can I simply point the wsgi directive at the appropriate python executable/ site packages?

And can you direct me at the contents of the apache script and the steps to make the web application run as expected?

Any assistance that you can provide me on the details of how to tie this all together would be much appreciated.

Thanks

John

unread,
Nov 3, 2014, 2:26:55 PM11/3/14
to django...@googlegroups.com
Robert,

You have to use a mod_wsgi that is built against python3. On Debian/Ubuntu, the package is called libapache2-mod-wsgi-py3.

On the matter of virtualenvs, I would still encourage their use so that you have per-application flexibility later, and you are not forced later to wrestle with python package dependency conflicts between your apps, or between an app and the operating system.

John

Collin Anderson

unread,
Nov 5, 2014, 12:17:06 PM11/5/14
to django...@googlegroups.com, john-...@martinhome.org.uk
Hello,
 
You have to use a mod_wsgi that is built against python3. On Debian/Ubuntu, the package is called libapache2-mod-wsgi-py3.
Also, there's an Red Hat package of mod_wsgi built against python 3.3 here:

The modwsgi list could probably give you even better advice. https://groups.google.com/d/forum/modwsgi

Collin

Reply all
Reply to author
Forward
0 new messages