Created
October 11, 2017 10:57
-
-
Save pharzan/c8dbe4d04c43e3aa510e5996a8542462 to your computer and use it in GitHub Desktop.
how to run a Django script with arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inside the script we should have something like below: | |
def run(*script_args): | |
print (script_args) | |
# from the shell when calling the script to run use the --script-args to pass in arguments and they will be recieved as tuples inside the script | |
#-> example: python manage.py runscript myscript --script-args Testing 123 | |
will return ('Testing','123') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment