I have a Django application and it works on Heroku. I want to run a simple script called import.py that imports a CSV file into my models. It works fine on my local computer. When I try to run a script on Heroku using this command:
heroku run python manage.py < import.py
Everything he does is reading the script back to me, but not executing any content. What am I doing wrong?
Edit:
This is the beginning of the result that I get at startup: heroku run python manage.py <import.py
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import csv
>>> from bah_api.models import withDependents, withOutDependents, ZipMHA
>>>
>>>
>>> def LoadCSV(file_location, my_model, delim):
... f = open(file_location)
File "<console>", line 2
f = open(file_location)
^
IndentationError: expected an indented block
>>> csv_f = csv.reader(f, delimiter=delim)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'f' is not defined
>>> for row in csv_f:
...
Display all 182 possibilities? (y or n)
Casey source
share