Skip to content

Instantly share code, notes, and snippets.

@pharzan
Created October 11, 2017 10:57
Show Gist options
  • Save pharzan/c8dbe4d04c43e3aa510e5996a8542462 to your computer and use it in GitHub Desktop.
Save pharzan/c8dbe4d04c43e3aa510e5996a8542462 to your computer and use it in GitHub Desktop.
how to run a Django script with arguments
# 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