Internet of Good Things (IoGT) is developed as a public good under a BSD-2 open-source license.
The development uses the Python programming language, building on the Django server-side web framework combined with the Wagtail content management system.
In line with the latest Wagtail Long Term Support release, IoGT 2.x supports:
- Wagtail 2.11.x
- Django 2.2.x, 3.0.x and 3.1.x
- Python 3.8 and 3.9
- PostgreSQL, MySQL and SQLite as database backends
If you'd like to contribute to IoGT development, the best way to get started is to clone a copy of this repository and run the code on your machine.
git clone https://github.com/unicef/iogt.git
cd iogt
Create an isolated Python environment, into which we will install the project's dependencies. This is highly recommended so that the requirements of this project don't interfere with any other Python environments you may have in your system, including the global Python environment. We also recommend that you create a new environment outside of the project directory.
python3 -m venv <path_to_venv_dir>
source <path_to_venv_dir>/bin/activate
pip install -r requirements.txt
Create the database. By default, an SQLite database will be created.
./manage.py migrate
Create a super user account for administration purposes.
./manage.py createsuperuser
Compile .po language files stored in locale/
./manage.py compilemessages
Finally, start the server.
./manage.py runserver
Once running, navigate to http://localhost:8000 in your browser.
-
Set up an elastic search cluster
-
Update local.py to use Elasticsearch as the backend. More details here
WAGTAILSEARCH_BACKENDS = { 'default': { 'BACKEND': 'wagtail.search.backends.elasticsearch7', 'URLS': ['http://localhost:9200'], 'INDEX': 'iogt', 'TIMEOUT': 5, 'OPTIONS': {}, 'INDEX_SETTINGS': {}, 'AUTO_UPDATE': True, 'ATOMIC_REBUILD': True } }
-
Run
./manage.py update_index
to update the ElasticSearch Index
It is possible to automatically populate the database with example data for a basic test site.
./manage.py create_initial_data
Optionally, create the main menu automatically as well.
./manage.py autopopulate_main_menus
./manage.py test --settings=iogt.settings.test
You can choose to set up the project locally using Docker Compose. This setup is recommended if you want to replicate the production environment
Clone the repository
git clone https://github.com/unicef/iogt.git
Run setup command. This will set up the database and also update the ElasticSearch Index.
cd iogt
make setup
Create a super user account for administration purposes.
docker-compose run django python manage.py createsuperuser
Run the compose file
make up
You're all set now. See the Makefile
for other commands related to docker-compose
It is possible to automatically populate the database with example data for a basic test site.
docker-compose run django python manage.py create_initial_data
Optionally, create the main menu automatically as well.
docker-compose run django python manage.py autopopulate_main_menus
Follow instructions here
Run the following command:
make test
Follow instructions here
It is possible to pull articles from other deployments assuming we know the secret key for that deployment.
In iogt/settings/local.py
, define parameters from wagtail-transfer as appropriate, e.g.:
WAGTAILTRANSFER_SECRET_KEY = 'fake_secret_key'
WAGTAILTRANSFER_SOURCES = {
'iogt_global': {
'BASE_URL': 'http://fake-iogt-url.org',
'SECRET_KEY': 'fake_secret_key_2',
},
}
Note: the names of transfer sources may only contain letters, numbers and underscores.
make cypress
cd cypress_tests/
npm install
node_modules/.bin/cypress open