Deploy an oTree project to Heroku using otreehub.com

If you choose to deploy oTree project from your local folder, the process is following:

  1. Open cmd.exe or Terminal in a folder where your project is extracted. You should be in folder where file settings.py is. For example now I can list my otree folders using:

Screenshot 2020-05-03 at 19.14.41.png

2. If you don’t have otree installed, install it with:

python3 -m pip otree

Screenshot 2020-05-03 at 19.17.02.png

3. Create .otreezip archive using:

otree zip

Screenshot 2020-05-03 at 19.18.38.png

After this step, you should have yourproject.otreezip file in the folder (instead of yourproject will be your project’s name).

4. In your browser, go to otreehub.com, Login with otreehub account and then select Heroku server deployment:

Screenshot 2020-05-03 at 19.21.04.png

5. In the Heroku Projects In the Active Sites click to Deploy

Screenshot 2020-05-03 at 19.24.40.png

6. In the Deploy page, Click to Choose File and select the .otreezip file we generated in step 3 and click Upload. The Build will start below and shows Build Progress for few minutes. Eventually build indicator should turn green and show Your build succeeded.

Screenshot 2020-05-03 at 19.29.00.png

7. When the build finishes, the last step is to Reset the DB – this will erase stored questionary results, but its necessary when we updated the structure of site, like add a new Form field. Click to Reset DB. It would require confirmation, that you know that all will be erased. Click OK there. Then it will show the DB Deployment progress similar way like with Build above, it would have several lines.

Screenshot 2020-05-03 at 19.34.30.png

8. When you get State changed from Up to complete on last line, that is the indication that all proceeded successfully. Now we are done.

You can now open your newly deployed page. The link is displayed in the top of the Deployment page in last line of First time setting up this project? In the fourth step. Click on it to open your new Questionary on Heroku.Screenshot 2020-05-03 at 19.37.00.png

Leave a comment