Thursday, 15 May 2014

How to pass parameter to a python script when I pipe it to a Django shell -



How to pass parameter to a python script when I pipe it to a Django shell -

so have integration test tests multiple components of application together, whole end-to-end test. need pipe django shell in order able access models etc. need pass parameter script. doing:

venv/bin/python src/manage.py shell < src/integration_tests/endtoend.py

but want is:

venv/bin/python src/manage.py shell < src/integration_tests/endtoend.py -o 2

if that, throws exception though:

usage: src/manage.py shell [options] runs python interactive interpreter. tries utilize ipython, if it's available. src/manage.py: error: no such option: -o

how should this?

you need write python script takes parameters , outputs script can pipe manage.py.

python src/integration_tests/endtoend.py -o 2 | python src/manage.py shell

i'm pretty sure wouldn't that, that's need pass in command line parameters.

other options environment variables , configuration files.

python django ubuntu

No comments:

Post a Comment