I have a Django project going on, containing some functions and creating/updating a database. From time to time, I need to update the staticfiles in the project therefore I created a .py file in the same folder as the project named updatefiles.py
I am running the script as python manage.py shell <updatefiles.py. Inside this file there is a for loop but for some reason it does not execute the for loop. I have tried even with a simple for loop such as below but it doesn't execute that one as well. Anyone has any ideas?
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
The output is:
(InteractiveConsole)
>>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> ... ... ... ... ... ... ... ... ... ... ...
now exiting InteractiveConsole...
Anyone has any ideas?
Edit: For anyone having the same issue, I solved it by changing the structure. I defined a function within settings.py and put the for loop inside this function. Then inside updatefiles.py I simply call this function. By running python manage.py shell <updatefiles.py it works now