Is there any sense in using Django framework for developing Command Line Interface tool? In my case there won't be any graphical interface. What benefits can I get using it? Or maybe you know any other useful frameworks for CLI? I'd like to put an accent on making HTTP requests with REST API.
UPDATE: Thanks guys! I would like rather to use REST API than create it in my tool.
While django is primarily for web apps it has a powerful and easy to use ORM that can be used for CLI apps as well. To use django script as a standalone script without a webserver, all you need to do is to add the following to the top of the file.
import os, sys
if __name__ == '__main__':
# Setup environ
sys.path.append(os.getcwd())
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
# Setup django
import django
django.setup()
# now you can import your ORM models
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With