Setting up Pyramid WSGI for Apache 2

876 views
Skip to first unread message

Timmy

unread,
Feb 1, 2011, 12:38:06 AM2/1/11
to pylons-devel
I'm attempting to migrate from Pylons 1.0, and following the
directions on http://docs.pylonsproject.org/projects/pyramid/dev/tutorials/modwsgi/index.html

but I keep getting

ImportError: No module named pyramid.paster

is there anything i should be doing?

Chris McDonough

unread,
Feb 1, 2011, 11:04:53 AM2/1/11
to pylons...@googlegroups.com

Hard to know. Sounds like your mod_wsgi's Python path doesn't include
Pyramid somehow.

- C

Jeff Madynski

unread,
Feb 1, 2011, 1:15:46 PM2/1/11
to pylons...@googlegroups.com
Timmy,
it sounds like you might have a config problem or possibly a
permissions problem.
Also note that during development, it is much easier to use paster
rather than apache since with apache you have to restart it every time
you change your code. Using paster significantly reduces the friction
in the development process.

Another resource that might tip you off to your problem is here:
http://code.google.com/p/modwsgi/wiki/IntegrationWithPylons

I got it apache / mod_wsgi working, but with a couple of caveats:
a) i used modwsgideploy, a helper script, read about it here:
http://turbogears.org/2.1/docs/main/Deployment/ModWSGI.html#deploy-modwsgi-deploy
b) i use a mac - apache layout may be different for you in terms of
user apache runs as, and file layout
c) i use virtualenv

Below are the relevant portions of my config files. I have bad naming
conventions, I was just learning how to do it myself.

Hope this helps,
--jeff


here is snippet from
httpd.conf which pulls in xexample.conf, which is the file that
contains the mod_wsgi 3.2 directives, among other things. most
important line is WSGIScriptAlias which is a python file for my web
app:

Include /private/etc/apache2/other/*.conf

That snippet will include this file xexample.conf which lives with
apache config files.
Here is /etc/apache2/other/xexample.conf
=========

Alias /xexample/images
/Users/jeff/src/.virtualenvs/xexample/xexample/public/images
Alias /xexample/css /Users/jeff/src/.virtualenvs/xexample/xexample/public/css
Alias /xexample/javascript
/Users/jeff/src/.virtualenvs/xexample/xexample/public/javascript
<Directory /Users/jeff/src/.virtualenvs/xexample/xexample/public>
Order deny,allow
Allow from all
</Directory>

WSGIDaemonProcess xexample threads=10 processes=3
WSGIProcessGroup xexample
WSGIScriptAlias /xexample
/Users/jeff/src/.virtualenvs/xexample/apache/xexample.wsgi

<Directory /Users/jeff/src/.virtualenvs/xexample/apache>
Order deny,allow
Allow from all
</Directory>

============

i have a virtual env
Remember that the apache user has to own the folder
Here is /Users/jeff/src/.virtualenvs/xexample/apache/xexample.wsgi
Notice how the python libraries in my virtualenv are pulled in.
======

import sys
prev_sys_path = list(sys.path)

import site
site.addsitedir('/Users/jeff/src/.virtualenvs/tg2_jeff/lib/python2.6/site-packages')

import os, sys
sys.path.append('/Users/jeff/src/.virtualenvs/xexample')

os.environ['PYTHON_EGG_CACHE'] =
'/User/jeff/src/.virtualenvs/xexample/python-eggs'

application = loadapp('config:/Users/jeff/src/.virtualenvs/xexample/development.ini')

===
after apache restart, pointing browser to http://localhost/xexample
loaded the home page of my app.

> --
> You received this message because you are subscribed to the Google Groups "pylons-devel" group.
> To post to this group, send email to pylons...@googlegroups.com.
> To unsubscribe from this group, send email to pylons-devel...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages