Tonbridge School Online Judge
Download docker.
Run the following:
pip install -r requirements.txt
.docker run -p 6379:6379 --name tsoj-redis -d redis
Alternate Redis installation:
- Install redis
sudo service redis-server start
Open three terminals, each running the following:
python wsgi.py
celery -A website.celery_worker.celery worker --loglevel=INFO
celery -A website.celery_worker.celery flower
sudo mongod --dbpath ~/data/db
(if using a local MongoDB)
Visit website at localhost:5000
Visit celery monitor at localhost:5555
In .env
, add a line: MONGO_URI=<connection-string>
Remember to put database name (dev
if for development, prod
if for production) in the connection string, after the last /
.
See .env configuration for a email address you can use without all the setup
- Go to Account Security
- Enable 2FA
- Go to App Passwords
- Select app
Other
and select deviceOther
and clickGenerate
- Copy the password and paste into
.env
asGMAIL_APP_PWD
- Put the email address into
.env
asGMAIL_EMAIL
SECRET_KEY="dev" # can be whatever
MONGO_URI=<connection-string> # Remember to put database name (tsoj) in the connection string, after the last `/`.
GMAIL_EMAIL=youremail@domain
GMAIL_APP_PWD=some_password
BASE_URL = 'http://127.0.0.1:5000'
CELERY_BROKER_URL = 'redis://127.0.0.1:6379' # default is port 6379
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379'
(In visual studio code): Press F1, select Python: Select Linter
, select mypy
Run git submodule update --init --force --remote
.
Run source venv/bin/activate
.