OpenWISP 2控制器

openwisp-controller的Python项目详细描述


https://travis-ci.org/openwisp/openwisp-controller.svghttps://coveralls.io/repos/openwisp/openwisp-controller/badge.svgRequirements Statushttps://badge.fury.io/py/openwisp-controller.svg

openwisp 2控制器模块(使用python和django web框架构建)。



在生产中部署它

自动安装程序可在ansible-openwisp2找到。

依赖关系

  • python 2.7或python>;=3.4
  • openssl

从pypi安装稳定版本

从pypi安装:

pip install openwisp-controller

安装开发版本

安装皮球:

pip install https://github.com/openwisp/openwisp-controller/tarball/master

或者,您也可以使用git:

pip install -e git+git://github.com/openwisp/openwisp-controller#egg=openwisp_controller

如果您想参与,请安装克隆的fork:

git clone git@github.com:<your_fork>/openwisp-controller.git
cd openwisp_controller
python setup.py develop
安装(在现有Django项目中集成)

^ ^{tt3}中的{tt1}$和EXTENDED_APPS(内部openwisp2设置)$ 应该如下所示(排序很重要):

INSTALLED_APPS=['django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','django.contrib.gis',# all-auth'django.contrib.sites','allauth','allauth.account','allauth.socialaccount','django_extensions',# openwisp2 modules'openwisp_users','openwisp_controller.pki','openwisp_controller.config','openwisp_controller.geo',# admin'openwisp_utils.admin_theme','django.contrib.admin',# other dependencies'sortedm2m','reversion','leaflet',# rest framework'rest_framework','rest_framework_gis',# channels'channels',]EXTENDED_APPS=('django_netjsonconfig','django_x509','django_loci',)

确保您使用的是一个可用的Geodjango后端,例如:

DATABASES={'default':{'ENGINE':'django.contrib.gis.db.backends.spatialite','NAME':'openwisp-controller.db',}}

openwisp_utils.staticfiles.DependencyFinder添加到STATICFILES_FINDERS中的settings.py

STATICFILES_FINDERS=['django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder','openwisp_utils.staticfiles.DependencyFinder',]

openwisp_utils.loaders.DependencyLoader添加到TEMPLATES中的settings.py

TEMPLATES=[{'BACKEND':'django.template.backends.django.DjangoTemplates','OPTIONS':{'loaders':['django.template.loaders.filesystem.Loader','django.template.loaders.app_directories.Loader','openwisp_utils.loaders.DependencyLoader',],'context_processors':['django.template.context_processors.debug','django.template.context_processors.request','django.contrib.auth.context_processors.auth','django.contrib.messages.context_processors.messages',],},}]

将以下设置添加到settings.py

FORM_RENDERER='django.forms.renderers.TemplatesSetting'CHANNEL_LAYERS={'default':{'BACKEND':'asgiref.inmemory.ChannelLayer','ROUTING':'openwisp_controller.geo.channels.routing.channel_routing',},}LOGIN_REDIRECT_URL='admin:index'ACCOUNT_LOGOUT_REDIRECT_URL=LOGIN_REDIRECT_URL

urls.py

fromdjango.confimportsettingsfromdjango.conf.urlsimportinclude,urlfromdjango.contrib.staticfiles.urlsimportstaticfiles_urlpatternsfromopenwisp_utils.admin_theme.adminimportadmin,openwisp_adminopenwisp_admin()urlpatterns=[url(r'^admin/',include(admin.site.urls)),url(r'',include('openwisp_controller.urls')),]urlpatterns+=staticfiles_urlpatterns()

安装以进行开发

安装sqlite:

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

安装分叉回购:

git clone git://github.com/<your_fork>/openwisp-controller
cd openwisp-controller/
python setup.py develop

安装测试要求:

pip install -r requirements-test.txt

创建数据库:

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

启动开发服务器:

./manage.py runserver 0.0.0.0:8000

您可以在http://127.0.0.1:8000/admin/访问管理接口。

使用以下命令运行测试:

./runtests.py

在Docker上安装并运行

从dockerfile生成:

sudo docker build -t openwisp/controller .

运行Docker容器:

sudo docker run -it -p 8000:8000 openwisp/controller

贡献

  1. OpenWISP Mailing List中宣布你的意图
  2. 分叉此repo并安装它
  3. 跟随PEP8, Style Guide for Python Code
  4. 编写代码
  5. 为代码编写测试
  6. 确保所有测试通过
  7. 确保测试覆盖率不会降低
  8. 记录您的更改
  9. 发送拉取请求

更改日志

CHANGES

许可证

LICENSE

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
添加了java JButton,但不可见   java在ArrayList的所有可能组合上循环   java是否不需要在构造函数中放入super()?   反射如何检查类是否属于JavaJDK   java列表。toArray(T[]a),如果“T”是“运行时类型”,该怎么办?   字符串连接使用java连接由管道和“:”分隔的整数值   在Java中打开枚举   Windows与Mac上的java正则表达式   java如何在正则表达式中匹配组?   在执行maven安装目标时,不会替换属性文件中的java占位符   java试图在wso2流处理器/流集成器上堆叠siddhi   java从intellij中的maven项目创建jar   java如何在TomEE+中配置Apache CXF ignoreNamespaces?   javajpa获取分离结果   OpenCV 4.3.0 java。Eclipse中的lang.UnsatifiedLinkError   java使用特定大小和特定值创建字节数组