Re: pylons cookbook startup script/activate_workingenv

2010-03-27 Thread Mike Orr
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

-- 
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.



Re: pylons cookbook startup script/activate_workingenv

2010-03-27 Thread mitochromium
#def application(environ, start_response):
#status = '200 OK'
#output = 'Hello World!'
#response_headers = [('Content-type', 'text/plain'),
#('Content-Length', str(len(output)))]
#start_response(status, response_headers)
#return [output]

WORKING_ENV = /home/mkh
APP_CONFIG = /home/mkh/main/config.ini

import activate_workingenv
activate_workingenv.activate_workingenv(WORKING_ENV)

from paste.deploy import loadapp
application = loadapp(config: + APP_CONFIG)

-- 
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.



Re: pylons cookbook startup script/activate_workingenv

2010-03-27 Thread mitochromium
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

-- 
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.



Re: pylons cookbook startup script/activate_workingenv

2010-03-27 Thread Mike Orr
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

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.

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.



Re: pylons cookbook startup script/activate_workingenv

2010-03-27 Thread cd34
I think that the documentation should be updated.  This same question
has been asked a few times on serverfault/stackoverflow recently.
Perhaps a deployment recipes section should be added that includes
multiple installation recipes.

The documentation on Graham's site (while not PEP-8 standard), does
work as expected.  Note that the EGG_CACHE should be a directory that
is writeable by the webserver, don't use /tmp or /var/tmp especially
if you have other .wsgi scripts running on the machine.  Apart from
the possible collision between egg caches, it could also cause
security issues.

Using the activate_this script causes more problems than it solves and
I haven't used it for anything I've deployed.  Also note that the
configuration listed on the mod_wsgi site provides a workable
solution, but, WSGIDaemon mode will provide higher performance.

-- 
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.



Re: pylons cookbook startup script/activate_workingenv

2010-03-27 Thread Graham Dumpleton
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.



pylons cookbook startup script/activate_workingenv

2010-03-26 Thread mitochromium
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.

Any ideas?

-- 
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.



Re: pylons cookbook startup script/activate_workingenv

2010-03-26 Thread cd34
Can you paste your .wsgi script?

and the full system path of where you installed the virtualenv?

-- 
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.