Multiple site package directories for Python and question about apache configuration

86 views
Skip to first unread message

robert brook

unread,
Nov 3, 2014, 3:18:06 PM11/3/14
to django...@googlegroups.com
I am building the web application on a linux red hat machine.

I was trying to pull the path for the site packages for the 3 modules that I have installed so that I can specify the path in the apache config file

Can I specify 2 paths in Apache?

Thanks



>>> import django

>>> print (django.__path__)

['/opt/rh/python33/root/usr/lib/python3.3/site-packages/Django-1.7-py3.3.egg/django']

 >>> import sql_server.pyodbc

>>> print (sql_server.pyodbc.__path__)

['/opt/rh/python33/root/usr/lib/python3.3/site-packages/django_pyodbc_azure-1.2.0-py3.3.egg/sql_server/pyodbc']

  

>>> import sqlalchemy

>>> print (sqlalchemy.__path__)

['/opt/rh/python33/root/usr/lib64/python3.3/site-packages/SQLAlchemy-0.9.7-py3.3-linux-x86_64.egg/sqlalchemy']

>>> 

robert brook

unread,
Nov 3, 2014, 3:24:17 PM11/3/14
to django...@googlegroups.com
I overlooked mentioning that the path command returned 2 different locations for the 3 modules.
Not sure why one package got installed in the lib64 path.  They were all installed with the setup.py install command.

Aliane Abdelouahab

unread,
Nov 3, 2014, 4:15:59 PM11/3/14
to django...@googlegroups.com
On linux, python installs libs in diffferents places: for example in open suse, when you install it the first time, and you choose python and some third party libraries, and then when you will do setup.py for a library you download, they will be in different locations!

robert brook

unread,
Nov 4, 2014, 7:26:12 AM11/4/14
to django...@googlegroups.com
I see that there are 2 paths in my application for site packages.

How do I configure Apache to use the 2 packages.

A typical entry in Apache is

WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python3.X/site-packages
Can I specify 2 paths to represent the 2 locations of site packages.
And what would the syntax be?

Aliane Abdelouahab

unread,
Nov 4, 2014, 8:13:39 AM11/4/14
to django...@googlegroups.com
i dont know how to do that, but the easied way is to just copy the whole packages and paste them in only one directory, since python packages are just folders/eggs

Scot Hacker

unread,
Nov 5, 2014, 10:41:31 AM11/5/14
to django...@googlegroups.com

You want to establish the path directories in your .wsgi file. Use `addsitedir` to set the path to site-packages and set additional paths with path.append, e.g.:

import os, sys, site

site.addsitedir('/path/to/site-packages')

sys.path.append('/extra/path/1')

sys.path.append('/extra/path/2')

Reply all
Reply to author
Forward
0 new messages