On 28 March 2010 04:32, Mike Orr <sluggos...@gmail.com> wrote:
> If you have a *.wsgi file, you must be using mod_wsgi. I don't know
> that configuration but here's the official documentation, found by
> googling "pylons mod_wsgi":
>
> http://code.google.com/p/modwsgi/wiki/IntegrationWithPylons

See:

  http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

> In general, to use a virtualenv, you run the python or paster or
> whatever in the 'bin' directory of the virtualenv.  Or you activate it
> on Unix/Mac by running "source myvirtualenv/bin/activate" or on
> Windows by running "myvirtualenv/Scripts/activate.bat".  Activating
> shifts your $PATH around to put the virtualenv at the beginning of it.
> Or you install virtualenvwrapper and run "workon myvirtualenv".
> (That's my preferred way.)  But mod_wsgi is different.  The virtualenv
> has an activate_this script that was originally intended for
> situations like mod_wsgi, but I think the mod_wsgi author has said not
> to use it. I may be wrong about that. I've cc'd Graham Dumpleton for
> clarification.

I discourage use of activate_this as it changes sys.prefix during
execution of process. This may be totally resasonable if your
application is only thing running within an interpreter, but mod_wsgi
allows multiple applications to run within same interpreter without
them being managed under a single entry point. One can only speculate
what changing sys.prefix in the middle of the execution of code
running in other threads will do.

Even using site.addsitedir() and reordering sys.path is probably not a
good idea to be done explicitly in WSGI script file as the documented
examples show as in a multithreaded system, two separate WSGI
applications could do same thing at same time and muck each over up.

The preferred method is therefore WSGIPythonPath if using mod_wsgi
embedded mode and python-path if using daemon mode. These methods
ensure that the fixups are done while still only a single thread
running and before any user code is actually run, thereby avoiding
multithreading issues and issues with changing sys.prefix.

Graham

> The IntegrationWithPylons article has a link to "mod_wsgi and
> workingenv.py".  I think the latter page should be deleted and
> mod_wsgi instructions put into the Pylons docs. Any objections to
> deleting it now?
>
>
>
> On Sat, Mar 27, 2010 at 6:35 AM, mitochromium <th...@thoughtboard.com> wrote:
>> OK thanks. Is the setup similar, though? i.e. creating a .wsgi file
>> and pointing it to the virtualenv? I can't seem to find any docs on
>> setting up virtualenv, just installation.
>>
>> On Mar 27, 3:12 am, Mike Orr <sluggos...@gmail.com> wrote:
>>> On Fri, Mar 26, 2010 at 9:54 PM, mitochromium <ajfar...@gmail.com> wrote:
>>> > I'm running through the cookbook, and have been stumped by the startup
>>> > script/activate_workingenv.py section.
>>>
>>> > I'm assuming (it's not really clear) that I'm supposed to replace
>>> > the .wsgi file contents with the startup script, which I did. I then
>>> > added activate_workingenv.py to my site-packages. It seems to be
>>> > behaving strangely, though. Upon restarting apache and visiting the
>>> > page, I get a 500 error. apache error_log states :
>>> >> IOError: [Errno 2] No such file or directory: 
>>> >> '/home/test/./lib/python2.5/setuptools.pth'
>>>
>>> > It seems to be concatenating with the "." no matter what, or if I omit
>>> > the period, strips root from string.
>>>
>>> > e.g. If I edit activate_workingenv.py to something like:
>>>
>>> >>package_root = os.path.join(root, '/lib/python' + python_version)
>>>
>>> > error_log will state:
>>>
>>> >> IOError: [Errno 2] No such file or directory: 
>>> >> '/lib/python2.5/setuptools.pth'
>>>
>>> > omitting WORKING_ENV/root from the string.
>>>
>>> Workingenv is old and no longer supported. Virtualenv has superceded
>>> it.  The recipe you're looking at may be obsolete.
>>>
>>> --
>>> Mike Orr <sluggos...@gmail.com>
>
>
>
> --
> Mike Orr <sluggos...@gmail.com>
>

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

Reply via email to