oTree Forum >

Problem setting my new project in otree hub

#1 by lucilaa

I have been using otree hub for a while for a project. Now I am coding a new experiment (will be running both simultaneously), so I created a new app in Heroku and registered it as a new project in otree hub.
I am having trouble launching the app/ resetting the database. I don't know what the current problem is (I had trouble with the heroku stack, python version, otree version, and those seem to be resolved). Now the code deploys, but it won't let me 'reset databse' and when I try opening the app it says "Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail")
The error message that comes up when I click on reset database is this:
Resetdb failed.
 Starting process with command `otree resetdb --noinput`
 State changed from starting to up
 Traceback (most recent call last):
   File "/app/.heroku/python/bin/otree", line 8, in 
   File "/app/.heroku/python/lib/python3.8/site-packages/otree/main.py", line 106, in execute_from_command_line
   File "/app/.heroku/python/lib/python3.8/site-packages/otree/main.py", line 130, in setup
     from otree import settings
   File "/app/.heroku/python/lib/python3.8/site-packages/otree/settings.py", line 30, in 
     import settings
   File "/app/settings.py", line 3, in 
     import dj_database_url
 ModuleNotFoundError: No module named 'dj_database_url'
 Process exited with status 1
 State changed from up to complete
 I tried pip install dj_database_url at it says it is already installed.
 Could it be because I have the other project/app running?
 Could it be because the code of my other otree experiment (the original that is running) is in the otreezip file?
 I can't seem to find a solution, but I need to be able to run both experiments at the same time (should I have just used the same project and didn't need to create a new one? ) 
 Thank you for the help,

#2 by Chris_oTree

Can you send me your project? I can take a look.

#3 by Chris_oTree


#4 by Chris_oTree

There are 2 solutions:

(1) Remove any of the following lines from your settings.py (either at the top or the bottom):

import dj_database_url
import otree.settings

(2) Downgrade your oTree version. If you're unsure what oTree version was originally used, try this, which will install the latest version of 3.x:

pip install "oTree<5"

It sounds like the experiment was developed with an older version of oTree, so the most guaranteed way is (2).

#5 by Chris_oTree

OK I took a look at the project you sent me. The best solution is to downgrade to an older version of oTree as i described in the email I sent you. I recommend running "otree update_my_code" to make sure it is compatible with oTree 3.4.

I recommend keeping this project on oTree 3.x. It looks like updating it to oTree Lite (5.x) might be some work.

#6 by lucilaa

update for anyone that might have the same problem: downgrading the otree version worked (pip install "oTree<5")

Write a reply

Set forum username