91 lines
2.0 KiB
Plaintext
91 lines
2.0 KiB
Plaintext
(All things work on debian squeeze)
|
|
|
|
To active the virtualenv:
|
|
|
|
* You need some basic system packages. Install them as 'root':
|
|
|
|
pip install virtualenv virtualenvwrapper
|
|
|
|
* Add the next lines at the end of the .bashrc or .zshrc file:
|
|
(you can change the python version for >2.6 not less)
|
|
|
|
# Activate virtualenvwrapper
|
|
export WORKON_HOME=$HOME/.virtualenvs
|
|
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='----python=/usr/bin/python2.6 --system-site-packages'
|
|
source /usr/local/bin/virtualenvwrapper.sh
|
|
|
|
* Refresh bash or zsh:
|
|
|
|
source ~/.bashrc
|
|
|
|
or
|
|
|
|
source ~/.zshrc
|
|
|
|
* Go to the main directory where is tryton, normaly 2 directory above it.
|
|
|
|
* If the enviroment is not created, do in the main directory:
|
|
|
|
mkvirtualenv <TRYTON_FOLDER_NAME>
|
|
|
|
* To install dependencies:
|
|
|
|
pip install -r nan-tryton/tryton-buildout/requirements.txt
|
|
|
|
|
|
More things to know:
|
|
|
|
* For the Nereid use you have to install flask:
|
|
|
|
pip install flask
|
|
|
|
* To logout the virtualnev:
|
|
|
|
deactivate
|
|
|
|
* To login the virtualenv:
|
|
|
|
workon <VIRTUALENV_NAME>
|
|
|
|
* To list the possible virtualenv's:
|
|
|
|
workon
|
|
|
|
* To automate the virtualenv login, add the next function in
|
|
the .bashrc or .zshrc:
|
|
|
|
# automatic de/activate virtualenv
|
|
function cd() {
|
|
builtin cd $@;
|
|
typeset venv
|
|
if [ -f .env ]; then
|
|
venv=`sh .env`
|
|
if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
|
|
if workon | grep -q "$venv"; then
|
|
workon "$venv"
|
|
fi
|
|
fi
|
|
fi
|
|
}
|
|
|
|
- Refresh the bash or zsh like explained before.
|
|
|
|
- You need in each virtualenv the file .env with:
|
|
|
|
echo "${PWD##*/}"
|
|
|
|
* Commands for the virtualenvwrapper:
|
|
|
|
http://virtualenvwrapper.readthedocs.org/en/latest/command_ref.html
|
|
|
|
* To see the libraries installed in the virtualenv:
|
|
|
|
yolk -l
|
|
|
|
* If you need update the dependencies file, first make 'yolk' and after:
|
|
|
|
pip freeze > tryton-buildout/requirements.txt
|
|
|
|
- Remember to remove the 'distribute' from requirements.txt file.
|
|
- And commit the changes.
|