Developer Installation Instructions

Note

This page is for developers who want to customize or extend OpenWISP Firmware Upgrader, whether for bug fixes, new features, or contributions.

For user guides and general information, please see:

Requirements

Install Dependencies

Install spatialite and sqlite:

sudo apt-get install sqlite3 libsqlite3-dev openssl libssl-dev
sudo apt-get install gdal-bin libproj-dev libgeos-dev libspatialite-dev

Installing for Development

Fork and clone the forked repository:

git clone git://github.com/<your_fork>/openwisp-firmware-upgrader

Navigate into the cloned repository:

cd openwisp-firmware-upgrader/

Launch Redis:

docker-compose up -d redis

Install test requirements:

pip install -r requirements-test.txt

Setup and activate a virtual-environment (we'll be using virtualenv):

python -m virtualenv env
source env/bin/activate

Make sure that your base python packages are up to date before moving to the next step:

pip install -U pip wheel setuptools

Install development dependencies:

pip install -e .
pip install -r requirements-test.txt
sudo npm install -g jshint stylelint

Install WebDriver for Chromium for your browser version from https://chromedriver.chromium.org/home and Extract chromedriver to one of directories from your $PATH (example: ~/.local/bin/).

Create database:

cd tests/
./manage.py migrate
./manage.py createsuperuser

Launch development server:

./manage.py runserver 0.0.0.0:8000

You can access the admin interface at http://127.0.0.1:8000/admin/.

Run celery and celery-beat with the following commands (separate terminal windows are needed):

# (cd tests)
celery -A openwisp2 worker -l info
celery -A openwisp2 beat -l info

Run tests with:

# run qa checks
./run-qa-checks

# standard tests
./runtests.py

# tests for the sample app
SAMPLE_APP=1 ./runtests.py --keepdb --failfast

When running the last line of the previous example, the environment variable SAMPLE_APP activates the app in /tests/openwisp2/sample_firmware_upgrader/ which is a simple django app that extends openwisp-firmware-upgrader with the sole purpose of testing its extensibility, for more information regarding this concept, read Extending OpenWISP Firmware Upgrader.

Important

If you want to add openwisp-firmware-upgrader to an existing Django project, then you can take reference from the test project in openwisp-firmware-upgrader repository