在django中重新实现OpenWISP Manager的旧版功能
项目描述
在django中重新实现OpenWISP Manager的旧版功能,用于OpenWISP2。
从pypi安装稳定版本
从pypi安装
pip install django-owm-legacy
安装开发版本
安装tar包
pip install https://github.com/openwisp/django-owm-legacy/tarball/master
或者您可以通过git使用pip安装
pip install -e git+git://github.com/openwisp/django-owm-legacy#egg=django-owm-legacy
如果您想贡献,请安装您克隆的分支
git clone git@github.com:<your_fork>/django-owm-legacy.git
cd django-owm-legacy
python setup.py develop
设置(集成到现有的django项目中)
将openwisp_controller和owm_legacy添加到INSTALLED_APPS中,如下所示
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',
# ...
]
settings.py中需要的其他设置
EXTENDED_APPS = ('django_x509', 'django_loci')
AUTH_USER_MODEL = 'openwisp_users.User'
SITE_ID = 1
您的urls.py应如下所示
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()
为开发安装
安装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
启动Redis
docker-compose up -d redis
安装您的分支
git clone git://github.com/<your_fork>/django-owm-legacy
cd django-owm-legacy/
python setup.py develop
安装测试需求
pip install -r requirements-test.txt
创建数据库
cd tests/
./manage.py migrate
./manage.py createsuperuser
启动celery工作进程(用于后台任务)
celery -A openwisp2 worker -l info
启动开发服务器
./manage.py runserver
您可以在http://127.0.0.1:8000/admin/访问管理界面。
使用以下命令运行测试
./runtests.py
设置
OWM_LEGACY_ALLOWED_SUBNETS
类型: |
列表 |
默认: |
['10.8.0.0/16', '127.0.0.1/32'] |
表示允许检索校验和下载配置存档的IP网络的字符串列表。
贡献
请参阅OpenWISP贡献指南。
变更日志
查看 变更记录。
许可证
查看 许可协议。
支持
查看 OpenWISP 支持渠道。