在django中重新实现openwisp管理器的遗留特性
django-owm-legac的Python项目详细描述
在django中为OpenWISP2重新实现openwisp管理器的遗留功能。
从pypi安装稳定版本
从pypi安装:
pip install django-owm-legacy
安装开发版本
安装皮球:
pip install https://github.com/openwisp/django-owm-legacy/tarball/master
或者,您也可以使用git:
pip install -e git+git://github.com/openwisp/django-owm-legacy#egg=django-owm-legacy
如果您想参与,请安装克隆的fork:
git clone git@github.com:<your_fork>/django-owm-legacy.git
cd django-owm-legacy
python setup.py develop
< H2>安装(在现有Django项目中集成)
将django_netjsonconfig、sortedm2m和owm_legacy添加到INSTALLED_APPS:
INSTALLED_APPS=[# other apps'django_netjsonconfig','sortedm2m','reversion','owm_legacy'# ...]
您的urls.py应该如下所示:
fromdjango.conf.urlsimportinclude,urlfromdjango.contribimportadminfromdjango.contrib.staticfiles.urlsimportstaticfiles_urlpatternsadmin.autodiscover()urlpatterns=[url(r'^admin/',include(admin.site.urls)),url(r'^',include('django_netjsonconfig.controller.urls',namespace='controller')),url(r'^',include('owm_legacy.urls',namespace='owm')),]urlpatterns+=staticfiles_urlpatterns()
安装以进行开发
安装sqlite:
sudo apt-get install sqlite3 libsqlite3-dev
安装分叉回购:
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
启动开发服务器:
./manage.py runserver
您可以在http://127.0.0.1:8000/admin/访问管理接口。
使用以下命令运行测试:
./runtests.py
设置
OWM_LEGACY_ALLOWED_SUBNETS
type: | ^{tt7}$ |
default: | ^{tt8}$ |
表示允许检索的IP网络的字符串列表 校验和并下载配置档案。
贡献
- 在OpenWISP Mailing List中宣布你的意图
- 分叉此repo并安装它
- 跟随PEP8, Style Guide for Python Code
- 编写代码
- 为代码编写测试
- 确保所有测试通过
- 确保测试覆盖率不低于90%
- 记录您的更改
- 发送拉取请求
更改日志
见CHANGES。
许可证
见LICENSE。