/home/tgdev/spacetime/lib/python2.6/site-packages/setuptools-0.6c11-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/pip-0.6.1-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/tg.devtools-2.1a3-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/repoze.who-1.0.18-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
repoze.what_quickstart-1.0.3_r6729-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/SQLAlchemy-0.5.6-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
sqlalchemy_migrate-0.5.4-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/TurboGears2-2.1a3-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/zope.interface-3.5.2-
py2.6-linux-x86_64.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Paste-1.7.2-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
repoze.who_friendlyform-1.0b3-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
repoze.what.plugins.sql-1.0rc3_r6698-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
repoze.who.plugins.sa-1.0rc2-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/repoze.what-1.0.8-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/decorator-3.0.0-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/repoze.tm2-1.0a5-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
repoze.what_pylons-1.0-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/WebError-0.10.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/ToscaWidgets-0.9.8-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/WebFlash-0.1a9-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Genshi-0.5.1-py2.6-
linux-x86_64.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Pylons-0.9.7-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
repoze.who_testutil-1.0rc1-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/transaction-1.0.0-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/simplejson-2.0.9-
py2.6-linux-x86_64.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Pygments-1.1.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Tempita-0.4-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/WebOb-0.9.6.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/WebTest-1.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Mako-0.2.5-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/nose-0.11.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/FormEncode-1.2.2-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/PasteScript-1.7.3-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/PasteDeploy-1.3.3-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/WebHelpers-0.6.4-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Routes-1.10.3-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Beaker-1.5.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/tgext.geo-0.6-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/TileCache-2.10-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/mapfish-1.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/psycopg2-2.0.13-
py2.6-linux-x86_64.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/GeoAlchemy-0.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/FeatureServer-1.12-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/tgext.admin-0.3.6-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/zope.sqlalchemy-0.4-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Babel-0.9.4-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/tgext.crud-0.3.3-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/sprox-0.6.6-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/geojson-1.0.1-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Shapely-1.0.14-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/tw.forms-0.9.8-
py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/
modwsgideploy-0.4.20dev-py2.6.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Cheetah-2.4.1-py2.6-
linux-x86_64.egg
/home/tgdev/spacetime/lib/python2.6/site-packages/Markdown-2.0.3-
py2.6.egg
/home/tgdev/spacetime/eagle
/home/tgdev/spacetime/lib/python2.6/site-packages
/var/www/wsgi-scripts
/opt/python2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
/opt/python2.6/lib/python2.6/site-packages/virtualenv-1.4.3-py2.6.egg
/opt/python2.6/lib/python26.zip
/opt/python2.6/lib/python2.6
/opt/python2.6/lib/python2.6/plat-linux2
/opt/python2.6/lib/python2.6/lib-tk
/opt/python2.6/lib/python2.6/lib-old
/opt/python2.6/lib/python2.6/lib-dynload
/opt/python2.6/lib/python2.6/site-packages
which looks exactly right - virtualenv libs first, default system libs
last.
My wsgi file looks like:
import os, sys
APP_NAME = 'eagle'
ENV_PATH = '/home/tgdev/spacetime'
APP_PATH = ENV_PATH + '/eagle'
PKG_PATH = ENV_PATH + '/lib/python2.6/site-packages'
prev_sys_path = list(sys.path)
import site
site.addsitedir(APP_PATH)
site.addsitedir(PKG_PATH)
os.environ['PYTHON_EGG_CACHE'] = '/var/tmp/' + APP_NAME + '/python-
eggs'
new_sys_path = []
for item in list(sys.path):
if item not in prev_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path
from paste.deploy import loadapp
application = loadapp('config:' + APP_PATH + '/development.ini')
and my virtual host config in apache looks like:
WSGIPythonHome /opt/python2.6
<VirtualHost *:80>
ServerName ***********
ServerAlias ***************
ServerAdmin *************
<Directory /var/www/static/eagle>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DocumentRoot /var/www/static/eagle
Alias /robots.txt /var/www/static/eagle/robots.txt
Alias /favicon.ico /var/www/static/eagle/favicon.ico
Alias /css/ /var/www/static/eagle/css/
Alias /images/ /var/www/static/eagle/images/
Alias /media/ /var/www/static/eagle/media/
#WSGIDaemonProcess eagle processes=2 threads=15 display-name=%
{GROUP}
#WSGIProcessGroup eagle
WSGIScriptAlias / /var/www/wsgi-scripts/eagle.wsgi
<Directory /var/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
What I see in the error_log is
[Sun Jan 03 05:17:54 2010] [error] [client 71.227.129.215] mod_wsgi
(pid=15568): Target WSGI script '/var/www/wsgi-scripts/eagle.wsgi'
cannot be loaded as Python module.
[Sun Jan 03 05:17:54 2010] [error] [client 71.227.129.215] mod_wsgi
(pid=15568): Exception occurred processing WSGI script '/var/www/wsgi-
scripts/eagle.wsgi'.
[Sun Jan 03 05:17:54 2010] [error] [client 71.227.129.215] Traceback
(most recent call last):
[Sun Jan 03 05:17:54 2010] [error] [client 71.227.129.215] File "/
var/www/wsgi-scripts/eagle.wsgi", line 22, in <module>
[Sun Jan 03 05:17:54 2010] [error] [client 71.227.129.215] from
paste.deploy import loadapp
[Sun Jan 03 05:17:54 2010] [error] [client 71.227.129.215]
ImportError: No module named paste.deploy
but I do not get that import error if I run the file from the command
line. What gives?
-Todd Blanchard
I can only guess that the virtual environment is not readable to the
user that Apache runs as.
In other words, be aware that Apache runs as a special user. That user
must have read/search access on directories and read access to files
in the directories. For directories this must be from '/' all the way
down to where actual Python code files are. Thus, if /home/tgdev has
permissions rwxr-x---, ie. not readable to others, will not be able to
read the code files.
So, check all your directory/file permissions properly.
Graham
On 9 February 2010 13:24, louisplp <loui...@gmail.com> wrote:
> I've got exactly the same problem.
It is not necessarily the same problem.
They had:
ImportError: No module named paste.deploy
You have:
ImportError: No module named deploy
The difference is important.
In your case a Python module or Python package root called 'paste' can
be found, but it can't find a submodule within it called 'deploy'.
This can occur for two reasons.
1. You have the actual package, but the permissions of only the top
level directory is correct and all the contents of the directory and
subdirectories have wrong permissions.
2. You have a distinct Python package, module or script of your own
somewhere on your module search path called 'paste.py' and that is
being found by mistake.
Do the following:
python
>>> import paste
>>> print paste.__file__
That will give you location.
If a script file called paste.py, then (2). If a file called
'__init__.py' in a directory called 'paste' then is likely (1), but
could also be (2).
Graham
> All the directories' permissions are right.
> I can't even run the wsgi script direclty with python
>
> $ python dispatch.wsgi
> Traceback (most recent call last):
> File "dispatch.wsgi", line 15, in <module>
> from paste.deploy import loadapp
> ImportError: No module named deploy
>
> All the virtualenv lib are first in sys.path
>
> Please help,
>
> Louis
>
> On 3 jan, 02:54, Graham Dumpleton <graham.dumple...@gmail.com> wrote:
>> 2010/1/3 Todd Blanchard <tblanch...@mac.com>:
>>
>>
>>
>> > Centos 5.3 at slicehost, TG2.1a3, apache2. I got mod_wsgi installed
>> > and the simple test wsgi script file works. Now I'm trying to launch
>> > my TG2 app using avirtualenv. I've cloned the wsgi file and run it
>> > which looks exactly right -virtualenvlibs first, default system libs
>> > last.
>>
>> > My wsgi file looks like:
>>
>> > import os, sys
>>
>> > APP_NAME = 'eagle'
>> > ENV_PATH = '/home/tgdev/spacetime'
>> > APP_PATH = ENV_PATH + '/eagle'
>> > PKG_PATH = ENV_PATH + '/lib/python2.6/site-packages'
>>
>> > prev_sys_path = list(sys.path)
>>
>> > import site
>> > site.addsitedir(APP_PATH)
>> > site.addsitedir(PKG_PATH)
>> > os.environ['PYTHON_EGG_CACHE'] = '/var/tmp/' + APP_NAME + '/python-
>> > eggs'
>>
>> > new_sys_path = []
>> > for item in list(sys.path):
>> > if item not in prev_sys_path:
>> > new_sys_path.append(item)
>> > sys.path.remove(item)
>> > sys.path[:0] = new_sys_path
>>
>> > frompaste.deploy import loadapp
python
>>> import paste
>>> print paste.__file__
That will give you location.
$ python
>>> import site
>>> site.addsitedir('/home/lemieulp/python_virtualenv/lib/python2.6/site-packages')
>>> import paste
>>> print paste.__path__
['/usr/lib/python2.6/site-packages/paste']
Here is what I have when using the virtualenv I created
$ ~/python_virtualenv/bin/python
>>> import paste
>>> print paste.__path__
['/home/lemieulp/python_virtualenv/lib/python2.6/site-packages/
PasteScript-1.7.3-py2.6.egg/paste', '/home/lemieulp/python_virtualenv/
lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste', '/home/
lemieulp/python_virtualenv/lib/python2.6/site-packages/Paste-1.7.2-
py2.6.egg/paste']
Yes, the .pth file (which is easy-install.pth) contains the required
namespace
$ cat easy-install.pth
import sys; sys.__plen = len(sys.path)
./setuptools-0.6c11-py2.6.egg
./pip-0.6.3-py2.6.egg
./Pylons-0.9.7-py2.6.egg
./Tempita-0.4-py2.6.egg
./WebTest-1.2-py2.6.egg
./WebError-0.10.1-py2.6.egg
./WebOb-0.9.8-py2.6.egg
./Mako-0.2.5-py2.6.egg
./nose-0.11.1-py2.6.egg
./decorator-3.1.2-py2.6.egg
./simplejson-2.0.9-py2.6-linux-i686.egg
./FormEncode-1.2.2-py2.6.egg
./PasteScript-1.7.3-py2.6.egg
./PasteDeploy-1.3.3-py2.6.egg
./Paste-1.7.2-py2.6.egg
./Beaker-1.5.1-py2.6.egg
./WebHelpers-1.0b4-py2.6.egg
./Routes-1.11-py2.6.egg
./Pygments-1.2.2-py2.6.egg
./Sphinx-0.6.4-py2.6.egg
./docutils-0.6-py2.6.egg
./Jinja2-2.2.1-py2.6.egg
./AuthKit-0.4.5-py2.6.egg
./elementtree-1.2.7_20070827_preview-py2.6.egg
./python_openid-2.2.4-py2.6.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:];
p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p
+len(new)
On 8 fév, 22:03, Ian Bicking <ianbick...@gmail.com> wrote:
> On Mon, Feb 8, 2010 at 8:43 PM, Graham Dumpleton <graham.dumple...@gmail.com
That is because site.addsitedir() sticks stuff at the end of sys.path
and doesn't reorder the path to put new additions at front and so
before anything that may be installed in site wide Python. Have a read
of:
http://code.google.com/p/modwsgi/wiki/VirtualEnvironments
where it talks about reordering and what you need to manually do
and/or how to avoid that by using python-path option or WSGIPythonPath
directive as appropriate.
Can you post more about the mod_wsgi configuration in Apache you are
using and what you have in the WSGI script file?
Graham
> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>
I did the reordering procedures of the sys.path variable.
Here is the mod_wsgi configuration in Apache. There is two pylons
application that I want to run, each with its own python virtualenv.
All the permissions of the virtualenv directories are OK (I can load
everything with another username).
I also tried changing the baseline environemnt, without succes
(WSGIPythonHome).
################### httpd.conf ###################
# Site de Louis-Philippe
<Directory /home/lemieulp/Public/Louis_HomePage/mod_wsgi>
Order deny,allow
Allow from all
</Directory>
NameVirtualHost *:8080
<VirtualHost *:8080>
# Site de Louis-Philippe
WSGIScriptAlias /lemieulp /home/lemieulp/Public/Louis_HomePage/
mod_wsgi/dispatch.wsgi
# # Site de Francois
# WSGIScriptAlias /francois /home/francois/MyBlog/apache/
myblog.wsgi
</VirtualHost>
################### httpd.conf ############# END #
And here is the WSGI script file in question.
################### dispatch.wsgi ###################
ALLDIRS = ['/home/lemieulp/python_virtualenv/lib/python2.6/site-
packages']
import sys
import site
# Original sys.path
prev_sys_path = list(sys.path)
# Add site-packages
for directory in ALLDIRS:
site.addsitedir(directory)
# Reorder sys.path
new_sys_path = []
for item in list(sys.path):
if item not in prev_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path
# Avoird ``[Errno 13] Permission denied: '/var/www/.python-egg'``
messages
import os
sys.path.append('/home/lemieulp/Public/Louis_HomePage')
os.environ['PYTHON_EGG_CACHE'] = '/home/lemieulp/Public/Louis_HomePage/
egg-cache'
# Load the Pylons application
from paste.deploy import loadapp
application = loadapp('config:/home/lemieulp/Public/Louis_HomePage/
development.ini')
################### dispatch.wsgi ############# END #
Here is the error log of Apache (with LogLevel set to debug).
################### Apache error_log ###################
[Tue Feb 09 09:03:23 2010] [info] mod_wsgi (pid=17449): Create
interpreter '::1:8080|/lemieulp'.
[Tue Feb 09 09:03:23 2010] [info] [client ::1] mod_wsgi (pid=17449,
process='', application='::1:8080|/lemieulp'): Loading WSGI script '/
home/lemieulp/Public/Louis_HomePage/mod_wsgi/dispatch.wsgi'.
[Tue Feb 09 09:03:23 2010] [error] [client ::1] mod_wsgi (pid=17449):
Target WSGI script '/home/lemieulp/Public/Louis_HomePage/mod_wsgi/
dispatch.wsgi' cannot be loaded as Python module.
[Tue Feb 09 09:03:23 2010] [error] [client ::1] mod_wsgi (pid=17449):
Exception occurred processing WSGI script '/home/lemieulp/Public/
Louis_HomePage/mod_wsgi/dispatch.wsgi'.
[Tue Feb 09 09:03:23 2010] [error] [client ::1] Traceback (most recent
call last):
[Tue Feb 09 09:03:23 2010] [error] [client ::1] File "/home/lemieulp/
Public/Louis_HomePage/mod_wsgi/dispatch.wsgi", line 27, in <module>
[Tue Feb 09 09:03:23 2010] [error] [client ::1] from paste.deploy
import loadapp
[Tue Feb 09 09:03:23 2010] [error] [client ::1] ImportError: No module
named deploy
################### Apache error_log ############# END #
Thank you!
On Feb 8, 11:27 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote: