Skip to content

openwisp/django-owm-legacy

Repository files navigation

django-owm-legacy

CI build status Test Coverage Dependency monitoring Chat Downloads code style: black

Legacy features of OpenWISP Manager reimplemented in django for OpenWISP2.

Install stable version from pypi

Install from pypi:

pip install django-owm-legacy

Install development version

Install tarball:

pip install https://github.com/openwisp/django-owm-legacy/tarball/master

Alternatively you can install via pip using git:

pip install -e git+git://github.com/openwisp/django-owm-legacy#egg=django-owm-legacy

If you want to contribute, install your cloned fork:

git clone [email protected]:<your_fork>/django-owm-legacy.git
cd django-owm-legacy
python setup.py develop

Setup (integrate in an existing django project)

Add openwisp_controller and owm_legacy to INSTALLED_APPS as follow:

INSTALLED_APPS = [
    # ...
    "django.contrib.sites",
    # allauth
    "allauth",
    "allauth.account",
    "django_extensions",
    # openwisp2 modules
    "openwisp_controller.config",
    "openwisp_controller.pki",
    "openwisp_controller.geo",
    "openwisp_controller.connection",
    "openwisp_users",
    "openwisp_notifications",
    "openwisp_ipam",
    # openwisp2 admin theme
    # (must be loaded here)
    "openwisp_utils.admin_theme",
    "django.contrib.admin",
    "django.forms",
    # other dependencies
    "sortedm2m",
    "reversion",
    "leaflet",
    "flat_json_widget",
    "owm_legacy",
    # ...
]

Other settings needed in settings.py:

EXTENDED_APPS = ("django_x509", "django_loci")

AUTH_USER_MODEL = "openwisp_users.User"
SITE_ID = 1

Your urls.py should look like the following:

from django.urls import include, path
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

admin.autodiscover()


urlpatterns = [
    path("admin/", include(admin.site.urls)),
    path("", include("openwisp_controller.urls", namespace="controller")),
    path("", include("owm_legacy.urls", namespace="owm_legacy")),
]

urlpatterns += staticfiles_urlpatterns()

Installing for development

Install sqlite:

sudo apt install -y sqlite3 libsqlite3-dev openssl libssl-dev
sudo apt install -y gdal-bin libproj-dev libgeos-dev libspatialite-dev libsqlite3-mod-spatialite

Launch Redis:

docker-compose up -d redis

Install your forked repo:

git clone git://github.com/<your_fork>/django-owm-legacy
cd django-owm-legacy/
python setup.py develop

Install test requirements:

pip install -r requirements-test.txt

Create database:

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

Launch celery worker (for background jobs):

celery -A openwisp2 worker -l info

Launch development server:

./manage.py runserver

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

Run tests with:

./runtests.py

Settings

OWM_LEGACY_ALLOWED_SUBNETS

type: list
default: ['10.8.0.0/16', '127.0.0.1/32']

List of strings representing ip networks allowed to retrieve checksums and download configuration archives.

Contributing

Please refer to the OpenWISP contributing guidelines.

Changelog

See CHANGES.

License

See LICENSE.

Support

See OpenWISP Support Channels.