Empty db.sqlite3 file

199 views
Skip to first unread message

Giacomo Rubbini

unread,
Jul 2, 2021, 3:06:27 PM7/2/21
to oTree help & discussion
Hi all,

I trying to set up a self-hosted Linux server to run oTree in our lab, and I am not sure whether what I am seeing is expected behavior or something is wrong with my setup.

I cd to my project's folder, I set the environment variables (DATABASE_URL, OTREE_ADMIN_PASSWORD, OTREE_AUTH_LEVEL, OTREE_PRODUCTION) and I run otree resetdb. This (re)creates a db.sqlite3 file, populated with different tables (regardless of the DATABASE_URL I set). 

I then run the prodserver (sudo -E env "PATH=$PATH" otree prodserver 80), input some data, and stop the server with Ctrl+C. However, if I now try to open db.sqlite3, the database seems to be empty (.tables in sqlite3 returns nothing). Is this expected behaviour, or I should check again my setup? 

Thanks!
Giacomo

 

Chris @ oTree

unread,
Jul 2, 2021, 3:08:34 PM7/2/21
to oTree help & discussion
did you restart your shell after defining the env vars so that they can be loaded? production should not use sqlite, so you should set DATABASE_URL to a postgres DB.

Giacomo Rubbini

unread,
Jul 3, 2021, 4:13:26 PM7/3/21
to oTree help & discussion
Hi Chris,

thanks for the fast reply. Yes, I tried restarting the shell with exec bash. It seems other variables are passed correctly, and even DATABASE_URL seems to be passed correctly but unless the string begins with sqlite://. For example, setting it to postgres:// or even something random like zzz:// gives respectively a server connection error and a sqlalchemy error (both expected). I'll try to see if switching to postgres helps!

Giacomo
Reply all
Reply to author
Forward
0 new messages