summaryrefslogtreecommitdiff
path: root/DEVELOP.md
blob: 2c9c6aaf381cec936d5c99be7b5cf06c547c7f93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
## Develop environnement for Debian buster

Installation instruction for a debian buster with sudo.

### Install base source code
``` bash
sudo apt-get update
sudo apt-get install git sed python3-venv python3-wheel python3-pip libpq-dev \
	python3-dev libjpeg-dev zlib1g-dev libxml2-dev libxslt1-dev libgeos-dev \
	python3-cairocffi tidy libtidy-dev binutils libproj-dev gdal-bin \
	libpangocairo-1.0-0 pandoc graphviz gettext

cd my_workspace
python3 -m venv ishtar-venv
. ./ishtar-venv/bin/activate
git clone https://gitlab.com/iggdrasil/ishtar.git  # or your forked project on gitlab
cd ishtar
pip3 install -r requirements.txt
```

### Install postgresql database

``` bash
sudo apt install postgresql postgresql-contrib postgresql-11-postgis-2.5 \
	postgresql-11-postgis-2.5-scripts
sudo -u postgres psql
```

``` sql
CREATE DATABASE ishtar;
CREATE USER ishtar WITH ENCRYPTED PASSWORD 'mypassword';
GRANT ALL PRIVILEGES ON DATABASE ishtar TO ishtar;
ALTER ROLE ishtar superuser;
```

### Configure and initialize your instance

``` bash
cd my_workspace
. ./ishtar-venv/bin/activate
cd ishtar
ISHTAR_PATH=`pwd`
cp example_project/local_settings.py.sample example_project/local_settings.py
editor example_project/local_settings.py
# edit settings: SECRET_KEY, DATABASE, comment STATIC_URL and MEDIA_URL
```

``` python
SECRET_KEY = "change-this-secret"

DATABASES = {
    'default': {
        'NAME': 'ishtar',
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'HOST': '127.0.0.1',
        'PORT': '5432',
        'USER': 'ishtar',
        'PASSWORD': 'mypassword',
    },
}

# STATIC_URL = BASE_URL + 'static/'
# MEDIA_URL = BASE_URL + 'mydomain/media/'
```

``` bash
cd example_project
# collect static data
python3 ./manage.py collectstatic --noinput

# compile translations
LOCALE=fr
python3 manage.py compilemessages -l $LOCALE

# DB feeding
python3 ./manage.py migrate

# loading fixtures
FIXTURES="$ISHTAR_PATH/fixtures/initial_data-auth-fr.json $ISHTAR_PATH/ishtar_common/fixtures/initial_data-fr.json $ISHTAR_PATH/ishtar_common/fixtures/initial_importtypes-fr.json $ISHTAR_PATH/archaeological_operations/fixtures/initial_data-fr.json $ISHTAR_PATH/archaeological_operations/fixtures/initial_data_relation_type_norel-fr.json $ISHTAR_PATH/archaeological_operations/fixtures/initial_data_relation_type-fr.json $ISHTAR_PATH/archaeological_context_records/fixtures/initial_data-fr.json $ISHTAR_PATH/archaeological_context_records/fixtures/initial_data_relation_type_norel-fr.json $ISHTAR_PATH/archaeological_context_records/fixtures/initial_data_relation_type-fr.json $ISHTAR_PATH/archaeological_files/fixtures/initial_data-fr.json $ISHTAR_PATH/archaeological_finds/fixtures/initial_data-fr.json $ISHTAR_PATH/archaeological_warehouse/fixtures/initial_data-fr.json"
for data in $FIXTURES; do
	echo $data;
	python3 ./manage.py loaddata $data;
done

# create superuser
python3 ./manage.py createsuperuser
```