#1 by lucilaa
Hello, 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 sys.exit(execute_from_command_line()) File "/app/.heroku/python/lib/python3.8/site-packages/otree/main.py", line 106, in execute_from_command_line setup() 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, Lucila
#2 by Chris_oTree
Can you send me your project? I can take a look.
#3 by Chris_oTree
chris@otree.org
#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 otree.settings.augment_settings(globals()) (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")
#7 by Gloria
Hi Chris, It seems I encountered the same problem. However, after I downgraded oTree, it does not work anymore. Build output -----> Building on the Heroku-22 stack -----> Using buildpack: heroku/python -----> Python app detected -----> Using Python version specified in runtime.txt ! ! Python 3.7 reached upstream end-of-life on June 27th, 2023, and is ! therefore no longer receiving security updates: ! https://devguide.python.org/versions/#supported-versions ! ! As such, it is no longer supported by this buildpack. ! ! Please upgrade to a newer Python version. ! ! For a list of the supported Python versions, see: ! https://devcenter.heroku.com/articles/python-support#supported-runtimes ! ! Push rejected, failed to compile Python app. ! Push failed Are there any ways that I can keep version 5.x and make the code work? Can I send my code to you for a review? Thank you very much! Best, Rui
#8 by Gloria
Here is the error when I was trying to reset the database Resetdb failed. Starting process with command `otree resetdb --noinput` State changed from starting to up /bin/bash: line 1: otree: command not found Process exited with status 127 State changed from up to complete Here is the Application error (heroku logs --tail) 2024-05-15T21:07:57.420681+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=workflow-9d7b5667d104.herokuapp.com request_id=69327cb9-46af-4984-8f58-c23e92476ea4 fwd="70.98.210.60" dyno= connect= service= status=503 bytes= protocol=https 2024-05-15T21:07:57.938929+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=workflow-9d7b5667d104.herokuapp.com request_id=4a5a5d07-1cde-4d1d-860f-9d71e7bf9e5f fwd="70.98.210.60" dyno= connect= service= status=503 bytes= protocol=https 2024-05-15T21:11:23.610430+00:00 app[api]: Starting process with command `otree resetdb --noinput` by user ruiwang2020@gmail.com 2024-05-15T21:11:26.197428+00:00 heroku[run.1327]: Starting process with command `otree resetdb --noinput` 2024-05-15T21:11:26.938447+00:00 heroku[run.1327]: State changed from starting to up 2024-05-15T21:11:26.950939+00:00 app[run.1327]: /bin/bash: line 1: otree: command not found 2024-05-15T21:11:27.015034+00:00 heroku[run.1327]: Process exited with status 127 2024-05-15T21:11:27.051569+00:00 heroku[run.1327]: State changed from up to complete 2024-05-15T21:12:56.614037+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=workflow-9d7b5667d104.herokuapp.com request_id=63ee30bf-5262-4146-b1b5-0476109261c6 fwd="70.98.210.60" dyno= connect= service= status=503 bytes= protocol=https 2024-05-15T21:12:57.121678+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=workflow-9d7b5667d104.herokuapp.com request_id=7ce6557e-7a7e-4dcf-a2fa-a0c368451e4f fwd="70.98.210.60" dyno= connect= service= status=503 bytes= protocol=https