Installation

Installing prerequisites:

Installation

You need to clone this repository:

git clone https://github.com/prise-3d/behavioral-online-experiment.git

With your python version (ideally python >= 3.7), you can the following required modules:

pip install -r requirements.txt

You may need to install sqlite3 on your system.

For linux based system:

apt update
apt install sqlite3

For Windows: you may need to install following this this: sqlite3.

Warning

It may required a new Python install.

Configure server

Add your own super user admin credentials:

cp credentials.example.json credentials.json

Warning

For Windows you may use the copy command.

Edit the credentials.json in order to configure your own admin account:

{
   "username":"username",
   "email":"",
   "password":"pass",
   "secret_key": "******"
}

You can generate and replace the secret key param using a Python interpreter:

from django.core.management.utils import get_random_secret_key
# print new random secret key
print(get_random_secret_key())

Caution

Django requires a secret key to securing signed data.

Database initialization

Initialize the database with the following command:

python manage.py makemigrations
python manage.py migrate

Then create the admin account:

For Linux:

bash create_admin.sh

Note

if you got a confirmation message that your administrator account has been created, everything is going well for the moment!

For Windows (without credentials.json):

python manage.py createsuperuser

Run the web application

python manage.py runserver

Note

The administrator interface is now available: http://127.0.0.1:8000/admin.

Or on a specific port:

python manage.py runserver 8080

Using docker

First, you need to add your own user admin credentials wished:

cp credentials.example.json credentials.json

Then, use make commands:

make build
make run

Or simply:

make deploy

You also have stop, remove, clean commands:

  • stop: stop current container instance if exists

  • remove: stop and remove container instance if exists

  • clean: remove docker image if exists