DEV Community

12944qwerty
12944qwerty

Posted on

How do you make arguments in bash with python?

I've recently used django to make websites, and while making them, I found that I could enter arguments into python files. I used python manage.py <arg> and it would do the specific things that it's supposed to do. I tried looking into manage.py to see how this was possible, but there was nothing there that would allow me to customize these args. (these arguments are honestly hard for me to remember)

So, my question for everyone, is how to make my own arguments? Or how to customize them?

Top comments (3)

Collapse
 
orenovadia profile image
orenovadia

Not sure if your question is Django specific or not.
Either way, One of the best libraries out there to build command line applications/scripts in python is click. It is succinct, elegant and way more easy to learn than Python's builtin ArgumentParser.

Collapse
 
12944qwerty profile image
12944qwerty

No, it wasn't Django specific but click answered my question. Thanks!

Collapse
 
micahlt profile image
Micah Lindley

Hm... I’m definitely no Python expert. I’m not sure! 😐