DEV Community

loading...

How do you make arguments in bash with python?

12944qwerty profile image 12944qwerty ใƒป1 min read

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?

Discussion (3)

pic
Editor guide
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 Author

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! ๐Ÿ˜