Wikipedia:Refill/Windows

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.

Warning 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

Setup

Getting the code

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

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'

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

Tab 1: celery

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

The web front end uses Webpack.

cd web/
npm run dev

Tab 3: flask

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

  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

  • 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

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.