Skip to content
lefterav edited this page Sep 14, 2010 · 21 revisions

WikiTrans is a Django application that makes heavy use of existing code, especially the construction mechanisms used in the Pinax Project.

All of my commands are written assuming an Apple computer is used. The variation is in how setting up some external apps is done. Please consult either Mac Ports or your system’s documentation. Generally, we need libyaml, PIL, Python (2.6 preferred), git (Mac Ports calls this git-core), sqlite3, virtualenv and virtualenvwrapper. Explaining how to install everything is beyond the scope of this document, but the following worked on my Mac

sudo port install git-core sqlite3 py26-virtualenv py26-virtualenvwrapper libyaml

For those new to VirtualEnv, you will probably need to add these two lines to your .profile (or .bashrc, etc).

export WORKON_HOME=$HOME/.virtualenvs
source /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/virtualenvwrapper_bashrc

Assuming that went well, let’s get on with the code.

mkdir ~/Desktop/wikitrans-system
cd ~/Desktop/wikitrans-system
git clone git://github.com/j2labs/wikitrans.git
git clone git://github.com/j2labs/pinax.git

We are in the pinax code base now. Pinax is a moving target and maintained, generally, by the fine folks at Eldarion. Because of that, I have a branch in my code that represents what I build WikiTrans against. Currently, this is the wt.dev-p0.7 branch, so we will check that out and setup the 0.7 environment. Remember, this is Pinax 0.7, not WikiTrans 0.7.

cd pinax
git checkout remotes/origin/0.7.X
git checkout -b 0.7.X

Now we setup the virtual environment using a boot script that will install pip (a Python programmers best friend). We then use pip to setup the Django environment.

python ./scripts/pinax-boot.py --development --source=. $WORKON_HOME/wt.dev
workon wt.dev
pip install --no-deps --requirement requirements/external_apps.txt

It’s going to work for a little while. Once it’s finished, we have some more stuff to install. This time we’re covering the requirements of WikiTrans. We first install pyyaml and PIL. They don’t appear to install cleanly from an requirements file… Anyway, we then install Wikipydia, Goopytrans, Pyango View, NLTK and some other things and we’re almost done.

cd ~/Desktop/wikitrans-system/wikitrans/
pip install -I pyyaml
pip install http://dist.repoze.org/PIL-1.1.6.tar.gz
pip install -I -r wt-app/requirements.txt  

Speaking of NLTK, we should download it’s data.

$ python
>>> import nltk
>>> nltk.download('all')

That’s all of the environment related stuff complete! Let’s create the database and run the system. By default, Wikitrans will setup an sqlite database called dev.db. It will also ask you about creating an admin user. Please do this. Use whatever username you want.

cd ~/Desktop/wikitrans-system/wikitrans/wt-app
./manage.py syncdb
./manage.py runserver

Go to http://127.0.0.1:8000/ and you should be greeted with the WikiTrans front *page.

Ubuntu 10.04

install necessary packages

sudo aptitude install python-setuptools python-dev build-essential  git-core sqlite3 python-nltk

Install pip

 sudo easy_install pip 

using pip, get the most important things (pip has an uninstall command, so one day you can clean up everything you’ve installed)

 sudo pip install virtualenv virtualenvwrapper 

Create a directory for our virtual environments

 mkdir ~/.virtualenvs

Configure bash to work with a virtualenvwrapper (Open a text editor and add these lines to the end of ~/.bashrc. Then you have to close the terminal window and open it again or relogin if you are on a console)

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper_bashrc # For 1.x version
source /usr/local/bin/virtualenvwrapper.sh # Since 2.x
export PIP_VIRTUALENV_BASE=$WORKON_HOME 

then let’s get the code

mkdir ~/Desktop/wikitrans-system
cd ~/Desktop/wikitrans-system
git clone git://github.com/j2labs/wikitrans.git
git clone git://github.com/j2labs/pinax.git

We are in the pinax code base now. Pinax is a moving target and maintained, generally, by the fine folks at Eldarion. Because of that, I have a branch in my code that represents what I build WikiTrans against. Currently, this is the wt.dev-p0.7 branch, so we will check that out and setup the 0.7 environment. Remember, this is Pinax 0.7, not WikiTrans 0.7.

cd pinax
git checkout remotes/origin/0.7.X
git checkout -b 0.7.X

Now we setup the virtual environment using a boot script that will install pip (a Python programmers best friend). We then use pip to setup the Django environment.

sudo python ./scripts/pinax-boot.py --development --source=. $WORKON_HOME/wt.dev
workon wt.dev
sudo pip install --no-deps --requirement requirements/external_apps.txt

It’s going to work for a little while. Once it’s finished, we have some more stuff to install. This time we’re covering the requirements of WikiTrans. We first install pyyaml and PIL. They don’t appear to install cleanly from an requirements file… Anyway, we then install Wikipydia, Goopytrans, Pyango View, NLTK and some other things and we’re almost done.

cd ~/Desktop/wikitrans-system/wikitrans/
sudo pip install -I pyyaml
sudo pip install http://dist.repoze.org/PIL-1.1.6.tar.gz
sudo pip install -I -r wt-app/requirements.txt  
sudo pip install apyrtium

Speaking of NLTK, we should download it’s data.

$ python
>>> import nltk
>>> nltk.download('all')

That’s all of the environment related stuff complete! Let’s create the database and run the system. By default, Wikitrans will setup an sqlite database called dev.db. It will also ask you about creating an admin user. Please do this. Use whatever username you want.

cd ~/Desktop/wikitrans-system/wikitrans/wt-app
./manage.py syncdb
./manage.py runserver

Go to http://127.0.0.1:8000/ and you should be greeted with the WikiTrans front *page.

Any other time you want to reboot this virtual environment, without installing everything from scratch, just type

workon wt.dev
Clone this wiki locally