Rafael Paz
Rafael Paz

Reputation: 537

How to debug a python file on pycharm passing multiple params?

I'm sorry if it's a trivial question, but couldn't find an answer for.

I'm really new to python and decided to use pycharm because I used to work with intellij in my previous job (Java).

Well, I wanna debug the code in pycharm, and in order to debug a project without providing any parameter it was just straight forward, just double click on the python file and choose debug...

The thing is, in order to run the project that I'm working on I have to run the following code on terminal

clear; clientid=d57f00e-8a58-c9e647144947 clientsecret="gGO1XjHly/NQZZvTTWET=" keyvaultidentifier=ty-keyvault tenant=9091f191-4969-4532-82ba-f9a96db6f8a6 environment=dev python3 -m testing_server

My question would be: How can I make this command a running command where I can debug the code on pycharm?

I found an option Run > Edit configuration > Python, but somehow didn't really understood what to place where

enter image description here

Any tips? Sorry for the trivial question, it just it's taking too long to do something so simple.

Cheers.

Upvotes: 0

Views: 757

Answers (3)

Vignesh Krishnan
Vignesh Krishnan

Reputation: 871

you should create a new file like dev.py inside your settings folder like.

[projectname]/
├── [projectname]/
│   ├── __init__.py
│   ├── [projectname]/
│   │   ├──settings.py
│   │   └──dev.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

load it when the project is in debug mode. and that file would contain all these values.

clientid=d57f00e-8a58-c9e647144947
clientsecret="gGO1XjHly/NQZZvTTWET=" 
keyvaultidentifier=ty-keyvault 
tenant=9091f191-4969-4532-82ba-f9a96db6f8a6 

and for debug. create a run config

like below

enter image description here

Upvotes: 0

Petronella
Petronella

Reputation: 2535

It seems you don't have any run configs, below is a screen shot of an example:enter image description here

Also, to use command line arguments, you can use the click module:

https://click.palletsprojects.com/en/7.x/

Upvotes: 1

The_C0der
The_C0der

Reputation: 24

This Post is also answerd here: Pycharm Run Parameters

In the field Script Parameters put your Parameters inside, for exampale: "gGO1XjHly/NQZZvTTWET=" but dont forget the double quotes.

in the Field Interpreter options you are putting the flag to call, for example: -clientsecret

Upvotes: 0

Related Questions