oTree Forum >

Sessions / rooms are expired after a few hours

#1 by evelizbeth

May I know if the rooms are intended to be closed automatically after a few hours?
Or is there a setting where the rooms can be active as long as I don't close it?

Thank you.

#2 by Elena

Hi,

I was wandering the same. Did you manage to keep the session active until needed?

Thank you!

#3 by evelizbeth

Hi,

Yes, I did. You need to set your database to Postgres and not SQlite.
Put this code in your settings.py
DATABASE_URL = 'postgres://postgres@localhost/django_db'

Also change it to postgres to in Heroku if you use Heroku.

Let me know if you have further question :)

#4 by Elena

Hi,

Thank you so much!! :)

#5 by Chris_oTree

The room should stay active until you manually close it. Is this happening locally or on Heroku? If Heroku, check your "configure" tab in oTree Hub to make sure the site is correctly configured.

#6 by Elena

Thank you! It happens locally

#7 by evelizbeth

Does it still happen after using the code I gave you?

#8 by Chris_oTree

Can you describe in more detail what happens? Does the room get closed automatically when you restart the server? Does the session itself get deleted? (Can you find it in the 'sessions' tab)

#9 by Chris_oTree

Also are you using 'otree devserver' or 'otree zipserver'?

#10 by Elena

Thank you so much for your help. 
I'm using the deployed experiment as heroku app. The deployment is done using the 'otree zip' command.
Both when I use the room and when I use the session for testing the experiment, the session/room gets deleted after 1 hr. I cannot find it in the 'session' tab and there is no data about the participants that already took the experiment. It happens locally. I was wandering whether there is a way for testing the experiment without having the session and/or the room automatically getting deleted after 1 hour.

Thank you so much again.

#11 by Chris_oTree

What is the full URL of your room? (This will help me understand whether this is on Heroku or on your localhost server.)

#12 by Elena

This is the room: https://choice-experiment.herokuapp.com/room/Sequence
While this the session for testing: https://choice-experiment.herokuapp.com/join/gahozano

Thank you!!

#13 by Chris_oTree

Can you show a screenshot of your "configure" tab for this site in oTree Hub?

#14 by Chris_oTree

(Or just let me know if any section is in red.)

#15 by Elena

Yes, it tells that I'm not using PostgreSQL. I've added the code DATABASE_URL = 'postgres://postgres@localhost/django_db' to settings.py in the experiment but it doesn't solve the problem.

#16 by Chris_oTree

Try deleting that line, re-deploy the code, then enable postgres through the oTree Hub interface.

#17 by Elena

Thank you so much!!

#18 by Elena

It works now!

Write a reply

Set forum username