I have set up a Django website with Github following the tutorial. I have also set up an associated job, which runs a python script before every deploy. The python script fails with the following error:
elif len(sys.argv) > 0 and sys.argv != 'collectstatic': IndexError: list index out of range
I assume this is because my python script calls
django.setup(), which then triggers the code above from the
settings.py file. As there are no other argv in the run command the index 1 results in out of range (i.e. the run script is simply:
python script.py, so no arguments)
How do I fix this? And in general, what’s the best way to run a python script that connects to my Django website?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.