Problems when putting app on Heroku

781 views
Skip to first unread message

Daniel Nettle

unread,
Aug 25, 2021, 6:14:06 AM8/25/21
to oTree help & discussion
I have a previously-working otree experiment that we ran on Heroku. It still works fine on otree devserver and and otree zipserver. However, when I now upload the zip file to Heroku, we get the following error message when the eighth participant joins the session. Nothing substantive has changed in the app since it was working fine. Any advice gratefully received!
Daniel

Application error (500)

Traceback

For security reasons, the error is not displayed here. You can view it with one of the below techniques:

  • Delete the OTREE_PRODUCTION environment variable and reload this page
  • Look at your Sentry messages (see the docs on how to enable Sentry)
  • Look at the server logs

Chris @ oTree

unread,
Aug 25, 2021, 6:23:48 AM8/25/21
to oTree help & discussion
In order to see the error message, you need to try one of the bulleted points. The second (Sentry) is the easiest, assuming you already enabled Sentry in oTree Hub. There will be more details there about what went wrong.

Daniel Nettle

unread,
Aug 25, 2021, 6:34:28 AM8/25/21
to oTree help & discussion
Thanks Chris. I have enabled Sentry in otree hub but can't work out how to see my Sentry messages (sorry to be dense).

Chris @ oTree

unread,
Aug 25, 2021, 6:46:38 AM8/25/21
to oTree help & discussion
You should have received an email invite a while ago. It's probably expired by now. To get a new one, go to oTree Hub, click "configure", and turn off Sentry. Press "submit changes", then re-enable Sentry. Then, you will receive email notifications of any future errors.

Daniel Nettle

unread,
Aug 25, 2021, 6:59:07 AM8/25/21
to oTree help & discussion
Great. I have sorted that. The Sentry error is below. It is to do with importing Python library numpy. Is this something to do with the requirements_txt? Thanks

ID: a8d6c55b527c4eb2b6e5e9ed484de5d9

Aug. 25, 2021, 10:56:50 a.m. UTC

Exception ModuleNotFoundError: No module named 'numpy'(25 additional frame(s) were not displayed)...  File "otree/views/abstract.py", line 865, in get    resp = self.inner_dispatch_group()  File "otree/views/abstract.py", line 913, in inner_dispatch_group    self._run_aapa_and_notify(self.group)  File "otree/views/abstract.py", line 886, in _run_aapa_and_notify    group_or_subsession.call_user_defined(aapa)  File "otree/database.py", line 610, in call_user_defined    return func(self, *args, **kwargs)  File "instructions/models.py", line 23, in group_formation    import numpy as np Message Exception in ASGI application Tags

·         environment = production

·         handled = yes

·         level = error

·         logger = uvicorn.error

·         mechanism = logging

·         runtime = CPython 3.9.2

·         runtime.name = CPython

·         release = 5.3.1

·         server_name = f15420c1-f15d-4647-b280-e0c33f651dd4

Chris @ oTree

unread,
Aug 25, 2021, 7:03:11 AM8/25/21
to oTree help & discussion
Yes, you should add numpy to your requirements.txt.
If there is a comment at the top of the file like 'otree-may-overwrite-this-file', delete that. this will prevent oTree from overwriting your customization.
Reply all
Reply to author
Forward
0 new messages