Utiliser zope avec virtualenv

17/50/2007 zope python

Virtualenv permets de créer un environement python indépendant de celui du système. C'est assez pratique lorsque l'on veut avoir plusieurs versions d'une même librairie.

Il est possible de l'utiliser avec Zope. C'est même très simple...

On install virtualenv avec easy_install:

~$ easy_install virtualenv

On s'extrait un Zope:

~$ tar xvzf Zope-2.X.X-final.tgz
~$ mv Zope-X.X.X-final myenv

On créer un virtualenv dans l'arborescence du Zope:

~$ virtualenv myenv
New python executable in myenv/bin/python
Installing setuptools......................done.
~$ source bin/activate
(myenv)$ which python
/home/gawel/myenv/bin/python

On utilise le python de l'environnement pour installer le Zope:

(myenv)~$ cd myenv
(myenv)~/myenv$ ./configure --with-python=bin/python

Using Python interpreter at bin/python

Configuring Zope installation

  - Zope top-level binary directory will be /opt/Zope-2.9.
  - Makefile written.

  Next, run make.

On le compile:

(myenv)~/myenv% make && make inplace

On peut ensuite créer des instances comme d'habitude. Ces instances utiliserons notre virtualenv.

 

Add a comment
Encolpe 12/02/2008 14:25

J'ai des réactions un peu différente pour le which python, mais la démarche est la même:

http://encolpe.wordpress.com/2008/02/05/du-bon-usage-de-easy_install/