Windows Development Environment Setup

Note

Ensure that you are executing all of the following steps with Administrator privileges!

Install prerequisites

Download the latest Redis installer from:
https://github.com/MSOpenTech/redis/releases

During the installation you will be asked to set what port Redis should listen on; leave it at the default (6379).

Download the latest Nodejs installer from:
https://nodejs.org/en/

Detailed setup

Note

For convenience these instructions consistently specify paths C:\pootle_venv, C:\git\pootle and C:\temp, but you can change these to suit your environment and needs.

Note

Depending on how correctly your environment is set up (depending on factors beyond your control such as virus scanners, Windows system health, and so on), you may need to use the command python -m pip for the following steps if the basic pip commands fail. Similarly, any other Python command that should ‘just work’ might need to be invoked with python -m to avoid issues.

For installing the dependencies in an isolated environment, set up a fresh virtualenv.

> pip install virtualenv
> virtualenv C:\pootle_venv

Activate the new virtualenv and upgrade pip:

> C:\pootle_venv\Scripts\activate
(pootle_venv)> pip install --upgrade pip setuptools

Clone your fork of the Pootle master using your favourite Windows implementation of Git so that you have a working copy somewhere accessible on your computer (e.g. C:\git\pootle).

Then go to the Pootle requirements\base.txt and comment out the following packages:

# lxml
# python-levenshtein
# scandir

These three packages are difficult to build on Windows, so we will download pre-built versions to install manually, saving them into your temporary folder:

Now install them explicitly:

(pootle_venv)> pip install C:\temp\lxml-3.6.4-cp27-cp27m-win32.whl
(pootle_venv)> pip install C:\temp\python_Levenshtein-0.12.0-cp27-none-win32.whl
(pootle_venv)> pip install C:\temp\scandir-1.2-cp27-none-win32.whl

At this point, you may be able to install Pootle and its requirements using the following command. However, pip installation of requirements may fail with “directory was not empty” or “file not found” issues, in which case you need to use the commands in the next note block.

(pootle_venv)> cd C:\git\pootle
(pootle_venv)> pip install -e .[dev]

Note

“Directory was not empty” and “file not found” issues come from modern versions of Windows’ tighter control over permissions for special folders. By default, pip stores temporary files in your user\AppData folder which may not allow access in all circumstances. By downloading the packages to a folder with no special permissions and building and installing them from there we can circumvent these problems:

(pootle_venv)> pip download -d C:\temp -r requirements\dev.txt -b C:\temp
(pootle_venv)> pip install -r requirements\dev.txt -b C:\temp -t C:\pootle_venv\Lib\site-packages\ --no-index --find-links="C:\temp"
(pootle_venv)> cd C:\git\pootle
(pootle_venv)> pip install -e .

Now that all the requirements are lined up, we are ready to initialise Pootle. You should be able to initialise the Pootle demo database the same way as on a Linux system.

Note

Depending on how successfully your system has engaged the virtual environment, you may have to execute pootle commands with python pootle/runner.py from the pootle root folder instead (e.g. python pootle/runner.py migrate instead of pootle migrate).

(pootle_venv)> pootle init --dev
(pootle_venv)> pootle migrate
(pootle_venv)> pootle initdb

Next, you will need to set up the client-side bundles with NPM. It might be necessary to deactivate the virtual environment or use a separate command window to perform this step, but it might also ‘just work’ from within the venv.

C:\git\pootle> cd pootle\static\js
C:\git\pootle\pootle\static\js> npm install

Once NPM install has completed, the actual javascript bundles can be compiled:

(pootle_venv)> cd C:\git\pootle
(pootle_venv)> pootle webpack --dev

The webpack command will keep running after it’s completed, to monitor your javascript files for changes so that it can auto-recompile as you work. You’ll need to either exit it with Ctrl+C once it has settled down, or else open up a new command prompt and activate your virtual environment there too.

One last javascript pack needs to be compiled to complete the client-side preparations:

(pootle_venv)> pootle compilejsi18n

Now create and verify a super-user as normal:

(pootle_venv)> pootle createsuperuser
[Follow on-screen prompts.]
(pootle_venv)> pootle verify_user [username]

Pootle is now ready to be fired up!

You will need to run one RQWorker and one Pootle server, so you’ll need two command prompt windows (as both will remain active until you disable the server):

(pootle_venv)> pootle rqworker
(pootle_venv)> pootle runserver

Congratulations, Pootle should now be running comfortably! Happy hacking on Windows!!