首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用于开发的NetBox插件安装

用于开发的NetBox插件安装
EN

Stack Overflow用户
提问于 2021-01-26 20:40:36
回答 1查看 513关注 0票数 0

我想为netbox开发一个插件。我在我的机器上安装了netbox,现在我必须安装插件,这个插件目前还很空白(类似于netbox文档中的插件)。有关如何安装或开发插件的基本信息,您可以查看netbox文档。I#m面临的问题是,当我尝试启动netbox服务器时,它找不到配置文件中列出的插件。

首先,我安装了插件

代码语言:javascript
复制
(venv) i518240@ubuntu:~/projects/netbox_dashboard$ python setup.py develop
running develop
running egg_info
creating ccloud_netbox_dashboard_plugin.egg-info
writing ccloud_netbox_dashboard_plugin.egg-info/PKG-INFO
writing dependency_links to ccloud_netbox_dashboard_plugin.egg-info/dependency_links.txt
writing top-level names to ccloud_netbox_dashboard_plugin.egg-info/top_level.txt
writing manifest file 'ccloud_netbox_dashboard_plugin.egg-info/SOURCES.txt'
reading manifest file 'ccloud_netbox_dashboard_plugin.egg-info/SOURCES.txt'
writing manifest file 'ccloud_netbox_dashboard_plugin.egg-info/SOURCES.txt'
running build_ext
Creating /home/i518240/projects/netbox/venv/lib/python3.8/site-packages/ccloud-netbox-dashboard-plugin.egg-link (link to .)
Adding ccloud-netbox-dashboard-plugin 0.1 to easy-install.pth file

Installed /home/i518240/projects/netbox_dashboard
Processing dependencies for ccloud-netbox-dashboard-plugin==0.1
Finished processing dependencies for ccloud-netbox-dashboard-plugin==0.1

之后,我将Netbox文件中的名称添加到configuration.py中

代码语言:javascript
复制
# Enable installed plugins. Add the name of each plugin to the list.
PLUGINS = [
    'ccloud-netbox-dashboard-plugin',
           ]

作为响应,我在尝试启动服务器时收到以下消息

代码语言:javascript
复制
django.core.exceptions.ImproperlyConfigured: Unable to import plugin ccloud-netbox-dashboard-plugin: Module not found. Check that the plugin module has been installed within the correct Python environment.

我使用的venv是Pycharm在我打开netbox目录时创建的venv。我希望你们中有人能帮我解决这个问题。如果您需要更多信息,只需添加评论即可。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-02-05 17:33:31

该问题是由于目录的命名不正确造成的。下面是一个正确命名的netbox插件目录的示例:

代码语言:javascript
复制
plugin_name/
  - plugin_name/
    - templates/
      - plugin_name/
        - *.html
    - __init__.py
    - middleware.py
    - navigation.py
    - signals.py
    - template_content.py
    - urls.py
    - views.py
  - README
  - setup.py

在我的例子中,名为plugin_name的目录有不同的名称。一个是正确的名字,另一个的名字略有不同。例如1.:plugin_name 2.:plugin-name

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65901557

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档