views:

94

answers:

2

I'm using Paste to run a Pylons application. Is there a way to specify in my paste config file to use the egg from the current directory (the same dir as the config file) instead of looking in global site-packages?

For example, right now the config file has:

[app:main]
use = egg:example

This definitely looks to site-packages. This wouldn't be a problem, except I'm running two versions of the same egg on the same server in a deployable, programmatic way, so I need to be able to deploy them from somewhere besides site-packages.

Thanks.

+1  A: 

Read this similar question, at least one of the answers should help you: http://stackoverflow.com/questions/1749452/making-python-use-code-in-my-directory-not-that-in-usr

UPDATE: You could rename the local module to something slightly different, like example_local.

DoR
The trouble is that this stuff is in a configuration file, and it needs to change depending on which file it's in. I don't have access to python stuff (e.g. I can't embed python into the config file). I can't just use environment variables because that's something shared between the two instances of the app.Tricky. Not sure exactly how I'd accomplish it, which is why I asked :-)
dave paola
+1  A: 

One way to use several versions of python package on the same system is virtualenv. It works by creating sandboxed environments. All global packages are "visible" from sandboxed environment, but you can install new packages inside the sandbox environment that won't affect rest of the system. I've successfully used this approach to host development and production version of a Pylons webapp on single server.

Pēteris Caune
Alternatively, look at buildout. Serves the same purpose as virtualenv (sandboxed environment) plus it serves as a sort of extensible makefile.
Reinout van Rees