$ pip3 install otree
$ pip3 install otree
$ pip3 install -U otree
Recommend upgrading every couple of weeks.
You might need to do the proxy server settings
In the Pycharm, you can open the terminal and install oTree as below:
$ set https_proxy address:password
$ pip install otree
$ otree startproject IGG
$ cd IGG
Run the server
Start your own terminal as a server.
$ otree devserver
Open your browser to http://localhost:8000/. You should see the oTree demo site.
To stop the server, press Control+C at your command line.
To create a new app, run
$ otree startapp app_name
Session configs are defined in settings.py
To upload the oTree application in a cloud server like Heroku is an important step to conduct the online experiments. Here, I am showing the steps that you need to fulfill to upload your application:
Make sure your oTree application is working correctly locally.
Create a Heroku account if you don’t already have one.
Install Heroku in your Mac: If you are a Mac user, you can install Heroku application from the homebrew as follows:
$ brew tap heroku/brew && brew install heroku
oTree
application to Heroku, first create an application name inside
your Heroku account as below:New…> Create New App
$ cd appname
$ export http_proxy="http://proxy.noc.kochi-tech.ac.jp:3128"
$ export https_proxy="http://proxy.noc.kochi-tech.ac.jp:3128"
$ heroku login
$ git init
$ git add .
$ git commit -am "command message"
$ heroku git:remote -a appname
$ git push heroku master
$ heroku config:set OTREE_PRODUCTION=1
Your oTree application should now be deployed to your Heroku server. You can access it by going to the URL provided by Heroku.
Note: Sometime due to the inconsistency in version of Python in your computer and reported Python version in runtime.txt might be different. In that case, you might not be able to rung the oTree program in computer. To get rid from it, you can remove the runtime.txt from your PyCharm.
Go to Resources tab. Following Add-ons need to be included for a small size experiment (For instance, 30 participants in one session).
Heroku Data for Redis ..... Premium 0
Heroku Postgres ........... Basic
Go to Settings tab. Click on Reveal Config Vars. Ensure that you have following Key and Value.
Key........................Value
OTREE_ADMIN_PASSWORD.......set any password
OTREE_AUTH_LEVEL...........Demo
OTREE_PRODUCTION...........1
heroku restart;heroku pg:reset DATABASE --confirm appname
Note: “appname” should be replaced with the custom application name
Updated on: 2024-10-17