wiki:InstallationGuidelines/VirtualEnv

virtualenv

Using virtualenv allows multiple Python applications to each have an independent set of Libraries to allow easier management of dependencies.

Install Non-Python Dependencies

You need to install libxml2, python-devel, and libgeos_c.

On Ubuntu, you can do this by running:

sudo apt-get install libxml2 libxml2-dev libxslt1-dev python-dev libgeos-c1 libfreetype6-dev

Install Python virtualenv

On linux install the virtualenv package using your package manager.

Ubuntu/debian:

aptitude install python-virtualenv

Windows:

  1. Install setup tools from http://pypi.python.org/pypi/setuptools
  2. Use easy_install to install virtualenv
    easy_install virtualenv
    

Using virtualenv

  1. Create a new virtualenv for your application
virtualenv dependencydirectory

The above creates a directory called dependencydirectory and initializes a new virtualenv inside it.

  1. Activate the virtualenv

On Linux/MacOSX/*ix:

source dependencydirectory/bin/activate

On Windows:

dependencydirectory\scripts\activate

Note: Steps 4 works only after step 2 has been executed in the current terminal.

  1. Download the required web2py version and place eden in the applications directory.
  1. Use the requirements.txt in the eden directory to install the dependencies
pip install -U -r requirements.txt
  1. Run web2py for development within this environment.
python web2py.py 

Using a virtualenv with apache/mod_wsgi

Append the following to WSGIDaemonProcess in the config:

 python-path=/home/web2py/dependencydirectory/lib/python2.6/site-packages

You can find further configuration details here -> http://code.google.com/p/modwsgi/wiki/VirtualEnvironments

Note: In the line above change python2.6 to your python version and the directory to match your directory

Using a virtualenv with uwsgi

Add -H path_to_dependencydirectory to your uwsgi parameters

You can find further details on this at -> http://projects.unbit.it/uwsgi/wiki/VirtualEnv

Optional: Use virtualenvwrapper

It's possible to use virtualenvwrapper, to simplify the installation process. The below instructions assume that you have installed and configured virtualenvwrapper.

Create and Activate the VirtualEnv

Create the virtualenv by running

mkvirtualenv --no-site-packages sahana-eden

This will automatically run

workon sahana-eden

which activates the virtualenv, by setting the necessary environment variables.

Download Web2Py and Sahana Eden

This can be installed anywhere, no need for it to be in the VirtualEnv folder

See wiki:InstallationGuidelinesDeveloper#Web2Py for instructions.

Install Python Dependencies with Pip

cd web2py/applications/eden
pip install -r requirements.txt

Running Sahana Eden

Switch to your virtualenv by running

workon sahana-eden

and start web2py and Sahana Eden as usual, by running

./web2py
Last modified 12 years ago Last modified on 07/12/12 12:25:01
Note: See TracWiki for help on using the wiki.