【问题标题】:NetBox plugin installation for development用于开发的 NetBox 插件安装
【发布时间】:2021-01-26 12:40:36
【问题描述】:

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

首先我安装了插件

(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

# Enable installed plugins. Add the name of each plugin to the list.
PLUGINS = [
    'ccloud-netbox-dashboard-plugin',
           ]

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

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是我打开netbox目录时由Pycharm创建的。 我希望你们中的某个人可以帮助我解决这个问题。如果您需要更多信息,请添加评论。

【问题讨论】:

    标签: python django netbox


    【解决方案1】:

    问题是由于目录命名不正确。 这是一个正确命名的 netbox 插件目录的示例:

    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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      • 1970-01-01
      • 2021-09-29
      • 1970-01-01
      • 1970-01-01
      • 2011-11-27
      • 1970-01-01
      相关资源
      最近更新 更多