Running the websites without a complete SADM setup¶
When hacking on the various web services included in SADM, it is not necessary
to setup a full-blown SADM infrastructure. Typically, when making the design of
concours website for a new edition, only a small Django setup has to be
completed.
Clone SADM and cd into it:
git clone https://github.com/prologin/sadm cd sadmConfigure the website:
# for the 'concours' site vim etc/prologin/concours.ymlRefer below for a guide of values to adapt depending on the website being worked on.
Create a venv (don’t activate it yet):
python -m venv .venv
Add the configuration path to
.venv/bin/activateso it is automatically set up when you activate the venv:echo "export CFG_DIR='$PWD/etc/prologin'" >> .venv/bin/activate
Activate the venv, install the requirements:
source .venv/bin/activate pip install -r requirements.txt -e .Apply the migrations, create a super-user and run:
# for the 'concours' site cd django/concours python manage.py migrate python manage.py createsuperuser --username prologin --email x@prologin.org # fill in the password; python manage.py runserver
Go to http://localhost:8000/, use
prologinand the password you just chose to log in.
Working on concours¶
Configuration¶
Customize etc/prologin/concours.yml with the following:
db.defaultThe easiest way is to use SQLite:
ENGINE: django.db.backends.sqlite3 NAME: concours.sqlite
contest.gameUse the correct year, typically
prologin2018for the 2018 edition.contest.directoryUse a writable directory, eg.
/tmp/prologin/concours_shared.website.static_pathPut the absolute path to
prologin<year>/www/staticor whatever directory is used for this edition.- Other
contestentries (eg.use_maps) Adapt to the correct settings for this edition.
Importing a stechec2 dump for testing¶
When developing the Javascript replay and other features, you might need to import test dumps that can be loaded on the website.
While in the correct virtualenv:
cd django/concours
python manage.py import_dump /path/to/my/dump.json
This will create a dummy match with zero players and no map, that will successfully load on the
dedicated URL. The match detail URL output by this command will only work in the default setup where
manage.py runserver is used on localhost:8000. Adapt the host/port if needed.