Hello @kartik,
You can debug a custom Django admin/management command in PyCharm by creating a custom Django server entry on the Run/Debug Configuration menu:
- Click Edit Configurations.
- Click the plus sign and choose Django server.
- Fill in the Name as you please, clear the Host and Port fields, check Custom run command and enter the name of your command to the right of the checkbox.
- Enter any extra command-line arguments into the separate field Additional options, not appended in the run command.
- Click OK.
Now set a breakpoint, choose your new configuration from the Run/Debug Configuration menu and click the Debug button.
Hope it helps!!
Thank you!!