netbox-community / netbox-qrcode

NetBox Plugin for generate QR Codes
Apache License 2.0
209 stars 31 forks source link

VSCode Breakpoints and Create auto Netbox User for developer and Chapter for Debeloper #80

Open LHBL2003 opened 4 months ago

LHBL2003 commented 4 months ago

I'm sorry, I've learned a lot in the last few days. But I'd say I'm done now. This extension is intended to help with the further development of the plugin. Summary of what has been done so far.

README Chapter for Developer

In the README a chapter for developers was created to get a better start if someone wants to help.

Makefile dokumentation

Makefile comments have been added. And the Makefile has also been extended to include "make debug-vscode". This prepares the Docker project for the VSCode RUN AND DEBUG mode.

Support debugging in VSCode with breakpoints

The following files were created to support debugging in VSCode with breakpoints:

image

.dockerignore .vscode/launch.json .vscode/tasks.json develop/docker-compose-debug.yml

More information can be found in the readme and in the files.

Automatically create the Netbox user admin with the password admin

The following files were created to achieve the automatic creation of the admin SuperUser user for Netbox. Makes it easier to get started with development and is only intended for Docker development.

First start image

Secound start image

develop/management/init.py develop/management/commands/init.py develop/management/commands/makesuperuser.py

The script file for creating the Netbox Admin is only distributed when using the Docker Compose development environment. The docker-compose.yml file has also been adapted so that makesuperuser is also executed here.

The makesuperuser.py script is built in such a way that it checks whether a SuperUser has been created. If not, it is created. So if you start the container again, there is no error message that there is already a user.

I am therefore asking for a test now :D

k01ek commented 2 months ago

Hi @LHBL2003 ! I don't think that root folder of this project its right place for vscode files. It's better to move it to develop folder or wiki. The same applies to the development part of readme.

LHBL2003 commented 2 months ago

Hi @k01ek,

I think the wiki is a good idea. I've never done it here, but it seems simple in theory. But I believe that you have to create a wiki page first so that this function is available to others in the repository. When I create a test repository, I have the WIKI tab. This is not available for selection in your repository or in my fork.

I can have a look at whether you can move the .vcode folder. Alternatively, I would describe the files in the wiki. (Whereby the second is of course not quite as nice :)

Can you @k01ek please provide the WIKI section. It should certainly be enough to create a home page.

closed/reopened this pull: It was an oversight. I wrote it on my mobile phone :D

LHBL2003 commented 1 month ago

Hi @k01ek,

Request from you: move the “.vscode”

Unfortunately you can't move the “.vscode” folder. See also in the Git of vscode: https://github.com/microsoft/vscode/issues/176354

I can only suggest 3 variants:

Request from you: WIKI

Since I have not heard anything from you about the Develop WIKI, I have created a separate “README_Development.md” file in the docs folder. The folder “README_Subpages” is there because there are more readme files for the “HTML Design” customization https://github.com/netbox-community/netbox-qrcode/pull/84.

ModuleNotFoundError: No module named 'setuptools'

With the current version, “make debug” and “make debug-vscode” were no longer possible because “install setuptools” is now required. This will also be a problem in your version. Fixed: https://github.com/netbox-community/netbox-qrcode/pull/80/commits/6eaff88ef4b25b869a1a2fb7f585d43394318524

cruse1977 commented 1 month ago

or replace:

RUN python setup.py develop

with

RUN python -m pip install --editable .

LHBL2003 commented 6 days ago

or replace:

RUN python setup.py develop

with

RUN python -m pip install --editable .

Hi @cruse1977 However, this would ensure that the plugin is no longer installed, as setup.py is no longer called. So Netbox starts, but the plugin is missing in your suggestion. image