Online judge Serious-OJ, built with asyncio on Python 3.
In the root of the repository, where requirements.txt
and package.json
locates:
python3 -m pip install -r requirements.txt
yarn
You don't need root privilege to run yarn
. It installs stuffs in the project directory. We recommend using Node 10.
You may want to use tuna if you are in China.
Some requirements may need Python.h
and ffi.h
. In Debian/Ubuntu you can use
apt install python3-dev libffi-dev
to resolve this.
To enable IP geo-location translation, you need to follow the instruction on MaxMind GeoLite2 to obtain a GeoLite2 City Database, unzip it, and put it in the project root directory with the filename GeoLite2-City.mmdb
.
You may also want to install libmaxminddb for higher performance.
In the root of the repository:
yarn build # or: yarn build:watch
python3 -m vj4.server --debug
Set
--listen
(default: http://127.0.0.1:8888) to listen on a different address.
As an intuitive example, you may want to add a super administrator and a problem to start:
alias pm="python3 -m"
pm vj4.model.user add -1 icebox 12345 icebox@iceboy.org
pm vj4.model.user set_superadmin -1
pm vj4.model.adaptor.problem add system "Dummy Problem" "# It *works*" -1 1000 # you can also use web UI
You need to run these scripts on a regular basis to maintain correct RP and ranks for all users:
pm vj4.job.rp recalc_all
pm vj4.job.rank run_all
Frontend source codes can be recompiled automatically by running:
yarn build:watch
However you need to manually restart the server for server-side code to take effect.
yarn build:production
python3 -m vj4.server --listen=unix:/var/run/vj4.sock
--listen
(default: http://127.0.0.1:8888) to listen on a different address.--prefork
(default: 1) to specify the number of worker processes.--ip-header
(default: '') to use IP address in request headers.--url-prefix
(default: https://vijos.org) to set URL prefix.--cdn-prefix
(default: /) to set CDN prefix.--smtp-host
, --smtp-user
, --smtp-password
, and --mail-from
to specify a SMTP server.--db-host
(default: localhost) and/or --db-name
(default: test) to use a different
database.Better to use a reverse proxy like Nginx or h2o.
To enable vj4 to judge, at least one judge user and one judge daemon instance are needed.
alias pm="python3 -m"
pm vj4.model.user add -2 judge 123456 judge@example.org
pm vj4.model.user set_judge -2
Have fun!
Maximum line width: 100
Indentation: 2 spaces
No commercial use, except get permission from us.