Skip to content

Commit

Permalink
Update docs and workflow to collect static files
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Mar 22, 2024
1 parent 40dc92b commit c843671
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
sudo touch /var/log/alyx_json.log; sudo chmod 666 /var/log/alyx_json.log
cd alyx
cp alyx/settings_ci.py alyx/settings.py
python manage.py collectstatic --noinput --link
coverage run manage.py test -n
coveralls --service=github
env:
Expand All @@ -73,7 +74,7 @@ jobs:
echo "requirements_frozen.txt unchanged"
rm requirements_frozen_temp.txt
echo "GIT_PUSH_NEEDED=false" >> "$GITHUB_ENV"
else
else
echo "requirements_frozen.txt is different, git push needed"
mv requirements_frozen_temp.txt requirements_frozen.txt
echo "GIT_PUSH_NEEDED=true" >> "$GITHUB_ENV"
Expand Down
26 changes: 14 additions & 12 deletions docs/gettingstarted.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Getting Started

The example details how to
1. install a local instance of Alyx
2. initialize it with the fixtures
1. install a local instance of Alyx
2. initialize it with the fixtures
3. register some local data to it
4. using the ONE-api, load the registered data

Expand All @@ -24,11 +24,11 @@ Go to the directory of your choice (for example: `/var/www/alyx-local`) and foll

Install required packages
```shell
# install required packages
# install required packages
sudo apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib virtualenv
```

Create log folder and folder for storing uploaded content.
Create log folder and folder for storing uploaded content.
```shell
sudo mkdir /var/log/alyx
sudo mkdir uploaded
Expand All @@ -38,7 +38,7 @@ sudo chown www-data:www-data -fR uploaded

Clone the repository and install the environment
```shell
git clone https://github.com/cortex-lab/alyx.git
git clone https://github.com/cortex-lab/alyx.git
virtualenv alyxvenv --python=python3
source ./alyxvenv/bin/activate
pip install -r requirements.txt
Expand All @@ -52,6 +52,7 @@ python setup.py
$ Enter a postgres username [alyxlocaluser]:
$ Enter a postgres password:
...
python alyx/manage.py collectstatic --noinput
python alyx/manage.py check
cd alyx
Expand Down Expand Up @@ -81,6 +82,7 @@ You can then visit http://localhost:8000/admin, connect as `admin:admin` (ie. us
* Type `pip install python-magic-bin`
* Type `python setup.py`, and follow the instructions.
* If everything went well you should see no error message and the message `Alyx setup successful <3`.
* Type `python alyx/manage.py collectstatic --noinput`. You should see a message about files being copied to ./alyx/alyx/static
* Type `python alyx/manage.py check`. You should see the message `System check identified no issues (0 silenced).`
* To reinitialize your local database, type `alyx/manage.py reset_db --noinput`
* To clone an existing alyx database from a backup, get an `alyx_full.sql.gz` in your alyx folder, and type `gunzip -f alyx_full.sql.gz`
Expand All @@ -90,14 +92,14 @@ You can then visit http://localhost:8000/admin, connect as `admin:admin` (ie. us
* Go to `http://localhost:8000/admin/`
## Interaction with the database
There are 3 main ways to interact with the database, listed below:
| | **Where** | **Who** | **Notes**
| --- | --- | --- | ---
| **Django Shell** | server only | admin only | This hits the database directly. It is a very powerful way to do maintenance at scale, with the risks associated. Run the `./manage.py shell` Django command to access the Ipython shell.
| | **Where** | **Who** | **Notes**
| --- | --- | --- | ---
| **Django Shell** | server only | admin only | This hits the database directly. It is a very powerful way to do maintenance at scale, with the risks associated. Run the `./manage.py shell` Django command to access the Ipython shell.
| **Admin Web Page** | web client | anyone | Manual way to input data in the database. This is privilegied for users needing to add/amend/correct metadata related to subjects. For the local database, this is accessible here: http://localhost:8000/admin.
| **REST** | web client | anyone | Programmatical way to input data, typically by acquisition software using a dedicated Alyx client [ONE](https://github.com/int-brain-lab/ONE) (Python) or [ALyx-matlab](https://github.com/cortex-lab/alyx-matlab) (Matlab).
Expand All @@ -107,8 +109,8 @@ There are 3 main ways to interact with the database, listed below:
### Create an experiment, register data and access it locally
Here we'll create the minimal set of fixtures to register some data to an experimental session.

1. create project
2. create repository
1. create project
2. create repository
3. assign repository to lab
4. create a subject

Expand Down Expand Up @@ -174,7 +176,7 @@ eid = session['url'][-36:] # this is the experimental id that will be used to r
# create a trials table in the relative folder defaultlab/Subjects/Algernon/yyyy-mm-dd/001
session_path = ROOT_EXPERIMENTAL_FOLDER.joinpath(
session['lab'], 'Subjects', session['subject'], session['start_time'][:10], str(session['number']).zfill(3))
alf_path = session_path.joinpath('alf')
alf_path = session_path.joinpath('alf')
alf_path.mkdir(parents=True, exist_ok=True)
ntrials = 400
trials = pd.DataFrame({'choice': np.random.randn(400) > 0.5, 'value': np.random.randn(400)})
Expand Down

0 comments on commit c843671

Please sign in to comment.