Pootle is a great tool for translation collaboration and used by many open source projects including a few from Mozilla. This post is about the Pootle installation procedure. Visit Pootle if you want to find more about Pootle translation platform.
Preparing the machine for Pootle installation – Prerequisites
Install Django
sudo apt-get install python-django python-mysqldb
Install Translate Toolkit
Download the latest tar.bz2 translate toolkit from sourceforge
Install (replace the XXX with the Translate Toolkit that you downloaded)
tar xvjf translate-toolkit-XXX.tar.bz2
cd translate-toolkit-XXX
sudo ./setup.py install
Install lxml
sudo apt-get install python-lxml
Install Python-Levenshtein (optional)
sudo apt-get install python-levenshtein
Install memcached (optional)
sudo apt-get install memcached
sudo apt-get install php5-memcache
Download Pootle
Download the latest stable Pootle translation platform from sourceforge
Extract the folder (replace XXX with the Pootle version that you downloaded):
sudo tar xvjf Pootle-2.1.6.tar.bz2
Testing your Pootle Prerequisites
At this point, you are ready to run Pootle from its built in server. This is a great way to test drive Pootle.
Go to the Pootle folder and run it:
cd Pootle-2.1.1
sudo ./PootleServer
Watch the terminal for status. If everything goes fine, you should see the following status. If your machine is missing dependencies, you will see them listed.
Browse to http://localhost:8080. You will get sort of an error message stating that Pootle is missing database tables. Don’t panic, Pootle will take responsibility and start creating the tables. After the process is completed, you will be presented with the Pootle home page
If you are satisfied with what Pootle has to offer, continue with the following procedure to install Pootle and configure with Apache and MySQL. Running Pootle from the integrated server with sqlite is not recommended for a production environment.
Installing Pootle and configuring with Apache and MySQL
Install Pootle
Copy the Pootle folder to your web root (if you want to install Pootle in a different place, you can do so. Just make sure apache has read/write permissions to the folder)
sudo cp Pootle-XXX /var/www
Run Pootle installation script
cd /var/www/Pootle-XXX
sudo ./setup.py install
Configure Pootle for MySQL
Create a database/user for Pootle
mysql -u root -p
CREATE DATABASE pootle CHARACTER SET = ‘utf8’;
GRANT ALL PRIVILEGES ON pootle.* TO [email protected] IDENTIFIED BY ‘pootlepassword’;
FLUSH PRIVILEGES;
Open the Pootle settings file
sudo nano /etc/pootle/localsettings.py
Update the file to use MySQL, and enter the database information that you just created
DATABASE_ENGINE = ‘mysql’
DATABASE_NAME = ‘pootle’
DATABASE_USER = ‘pootle’
DATABASE_PASSWORD = ‘password’
DATABASE_HOST = ‘localhost’
DATABASE_PORT = ‘3389’
Install and configure Apache and mod_wsgi
sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-wsgi
Open httpd.conf for apache and enter the Pootle configuration. If you modified any of the installation locations, edit it accordingly.
# point at the wsgi loader script
WSGIScriptAlias /pootle /var/www/Pootle/wsgi.py
# directly serve static files like css and images, no need to go through mod_wsgi and django
Alias /pootle/html /var/www/Pootle/html
<Directory /var/www/Pootle/html>
Order deny,allow
Allow from all
</Directory>
# Allow downloading translation files directly
Alias /pootle/export /var/www/Pootle/po
<Directory /var/www/Pootle/po>
Order deny,allow
Allow from all
</Directory>
Restart apache
sudo /etc/init.d/apache2 restart
Your Pootle translation platform instance should know be accessible at:
http://localhost/pootle
Thank you for the guide, very useful!
Only one addition from my side: If you choose to use memcached (suggested) youhave to activate it in the pootle configuration.
To do run sudo nano /etc/pootle/localsettings.py and make following changes:
CACHE_BACKEND = ‘memcached://localhost:11211/’
SESSION_ENGINE = ‘django.contrib.sessions.backends.cached_db’
Now install the python bindings for memcached (failing to do so will result in a InvalidCacheBackendError: Memcached cache backend requires either the ‘memcache’ or ‘cmemcache’ library)
apt-get install -yq python-setuptools
easy_install python-memcached
That’s it!
Thanks for adding this, Matpen.
Is there anything wrong in
apt-get install python-memcache
?
Looks correct to me, is it not working for you?
hi thanks for the guide, but i was unable to integrate mysql with Pootle. the pootle database has been created but has no tables.
In the pootle seettings file
DATABASE_PASSWORD = ‘password’
what does ‘password’ mean is it the mysql password or the pootlepassword?
That would be the password for the mysql user that you specified in the same file
Excellent guide. Tried it today on Ubuntu 12.04.
There is only one problem with MySQL setup:
Pootle will still use Sqlite unless the localsettings.py file in the /var/www/pootle directory is modified as described in the text BEFORE running the setup.py in the /var/www/pootle directory. Looks like it overrides the /etc/pootle/localsettings.py version.
I also installed and configured mysql and apache (following your instructions) BEFORE running setup.py. It might work otherwise, but I don’t want to try installing from scratch for a 6th time :-).