oTree

type access

type access

oTree is a framework based on Python which allows to build:

  • multiplayer strategy games (e.g. prisoner’s dilemma, public goods game, and auctions);

  • controlled behavioral experiments in economics, psychology, and related fields;

  • surveys and quizzes.

For more information, check here.

Input folder

The app receives a mandatory parameter, Input Folder, namely the directory with the source code including the oTree file settings.py, or an empty directory in order to create a new project.

Running an existing oTree project

In order to use oTree in production, it is necessary to run the production server, via the prodserver command. prodserver automatically runs Django’s collectstatic. If the user have already run collectstatic, she/he can skip it by selecting the --no-collectstatic option.

If the user is just testing the app, she/he can use the devserver command.

Creating a new oTree project

The command option startproject allows to create a new oTree project. Once selected this option, it is necessary to choose the name for the project folder. Once the project is created, the user is automatically moved in the oTree project directory.

In addition the user:

  • can add the startapp option to create a new oTree application and choose its name

and/or

  • select the prodserver or devserver option

Input parameters and command options

The user can select one or more optional parameters, e.g.:

  • PRODUCTION Mode set to 1 enables PRODUCTION mode (default is 0 for DEBUG mode)

  • ADMIN password allows to change the password (by default the username is admin and the password is admin-password)

  • AUTH LEVEL set to "STUDY" enables restricted access (default is "DEMO")

  • resetdb resets the database to a fresh state, all data are deleted

  • zip zip the otree project into an archive, user should be inside the project folder.

Note

If a database is already present, by using resetdb all data will be deleted.

Automated testing

Tests of the project apps can be launched by adding 'use_browser_bots': True to the respective session configuration in settings.py and using the option test --export. The --export flag is added to export the data generated by the bots to a CSV file stored in oTree’s project directory. The user needs to choose the directory name.

In order to simulate the app in a more realistic way, instead of using the test --export command, one can run the server and create a session. The pages will auto-play with browser bots once the start links are accessed.

Additional Dependencies

Additional packages can be installed inside the application container using the Additional dependencies parameter. The user should provide the list of packages via a text file (.txt). The installation is done via the pip package installer.

Alternatively, it is possible to load a Bash script (*.sh) with the list of shell commands to be used for the installation.