Jump to content

Wikipedia:Refill/Windows

From Wikipedia, the free encyclopedia

This page describes how to set up a local instance of reFill on Windows 10 or Windows 11. Once set up, the instance can be used to process bare URLs, to understand the reFill project's architecture and code, or to develop bug fixes and enhancements. reFill was developed using open source software and the Linux stack, and the instructions for building an instance for those who are comfortable with Linux, Kubernetes and Docker can be found on GitHub. The instructions below are intended primarily for those who use Microsoft Windows and do not want to go to the effort of setting up a Linux environment.

All credit goes to TheresNoTime for writing these instructions.

red-outlined triangle containing exclamation point These instructions have been tested only by a couple of individuals. Each Windows setup is unique. You may run into errors or difficulties we've not encountered. If so, please discuss on the talk page.

Software you'll need

[edit]

Setup

[edit]

Getting the code

[edit]

Open a PowerShell window, and download the latest source code from GitHub as follows:

git clone https://github.com/curbsafecharmer/refill.git
cd refill/

Hack around Makefile to setup

[edit]

If you don't have make installed, the steps (make setup) won't work, in which case in the same PowerShell window, enter the following:

cd backend/
pipenv install --dev
cp celeryconfig.example.py celeryconfig.py
cd ../web
npm install
cd ..

When you try to run pipenv, if you get a command not found exception, append the path of your Python installation to the Path variable in the current window by entering the following (replacing <username> with your Windows username):

$env:Path += ";C:\Users\<username>\AppData\Roaming\Python\Python38\Scripts"

Run the 'stack'

[edit]

You'll need three terminal windows running (or you could use the beautifully tabbed Windows Terminal)

Tab 1: celery

[edit]

Celery receives the requests for the API and queues them to run on the backend:

cd backend/
celery worker --autoscale=100,10

If celery.exe is not found, change to

venv\scripts\celery worker --autoscale=100,10

Tab 2: webpack

[edit]

The web front end uses Webpack.

cd web/
npm run dev

Tab 3: flask

[edit]

Flask is the web framework used to run the back end:

cd backend/
set FLASK_APP=app.py
set FLASK_DEBUG=1
flask run

If flask.exe is not found, change to

venv\scripts\flask run

Testing

[edit]
  1. The URL that the API should be running at will be shown in the PowerShell window where Flask is running, e.g. http://127.0.0.1:5000/ - open that URL in a browser to test the API.
  2. Expand the 'POST', click the 'Try it out' button and then click on 'Execute'. You should get a '202' response shown under 'Server response'.
  3. Expand the first 'GET' method, click the 'Try it out' button. Copy the taskName value (probably fixWikipage) and the taskId value (a GUID) from the response body into the two fields, then click 'Execute'. Inspect the "state" of the Celery job in the response, e.g. "PENDING".

Gotchas

[edit]
  • If you're using venv, you'll need to ensure you activate the virtual env prior to any python related steps (tab 1, tab 3)
  • If you're using Python launcher and venv, you'll need to do py -3.8 (unless that's already your default)

See also

[edit]