Django 由于Python包出错,无法部署Heroku

Django 由于Python包出错,无法部署Heroku,django,github,heroku,csv-import,Django,Github,Heroku,Csv Import,我正试图在Heroku上上传我的django应用程序。它可以在本地运行,因为我更正了错误,但由于某种原因,在我添加了whitenoise以获取本地文件以便可以在Heroku上部署之后,它不断出现相同的错误。 我正在加载一个本地包csv导入,它在第70行有一个错误 class ImportModel(models.Model): """ Optional one to one mapper of import file to Model """ #this is the line

我正试图在Heroku上上传我的django应用程序。它可以在本地运行,因为我更正了错误,但由于某种原因,在我添加了whitenoise以获取本地文件以便可以在Heroku上部署之后,它不断出现相同的错误。 我正在加载一个本地包csv导入,它在第70行有一个错误

class ImportModel(models.Model):
    """ Optional one to one mapper of import file to Model """
    #this is the line with the error and I fixed it here with the on_delete
    csvimport = models.ForeignKey(CSVImport, on_delete=models.DO_NOTHING)
    numeric_id = models.PositiveIntegerField()
    natural_key = models.CharField(max_length=100)
然而,当我跑步时:

git push heroku master
我得到了下面的错误,我已经在我的本地修复,但似乎一直与Heroku。文件已更改。我可能不在Heroku给定的正确文件路径上。我的计算机上没有app/.Heroku/。但是,在我的计算机上只安装了一个csv导入,并且已如上所述进行了修复。为什么我总是遇到这个错误,我该如何修复它

remote:          File "/app/.heroku/python/lib/python3.7/site-packages/csvimport/models.py", line 72, in ImportModel
remote:            csvimport = models.ForeignKey(CSVImport)
remote:        TypeError: __init__() missing 1 required positional argument: 'on_delete'
remote: 
remote:  !     Error while running '$ python manage.py collectstatic --noinput'.
emote:        See traceback above for details.
remote: 
remote:        You may need to update application code to resolve this error.
remote:        Or, you can disable collectstatic for this application:
remote: 
remote:           $ heroku config:set DISABLE_COLLECTSTATIC=1
remote: 
remote:        https://devcenter.heroku.com/articles/django-assets
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to gentle-lowlands-98196.
remote: 

问题在于静态目录,首先必须运行: “python manage.py collectstatic”
这将为您提供静态目录的路径或一个异常,就像您正在使用没有静态根目录的静态URL一样。

问题在于静态目录,首先您必须运行: “python manage.py collectstatic”
这将为您提供静态目录的路径或一个异常,就像您使用的是没有静态根目录的静态URL一样。

我认为您会遇到此错误,因为您需要首先将更改推送到repo。您确定在推之前将更改提交到git吗?问题是此cvs导入处于不同的位置文件夹位于lib/python3.7/site-packages/csv-import中,而我的项目位于src/djanopractice/myproject中。我正在推送表单myproject文件夹。我需要从src推吗?@Sam,我很确定我几天前在本地修复了此错误,并于今天创建了git存储库。我认为您会遇到此错误,因为您需要首先将更改推送到repo。您确定在推之前将更改提交到git吗?问题是此cvs导入位于它所在的不同文件夹中lib/python3.7/site-packages/csv-import,而我的项目位于src/djanopractice/myproject中。我正在推送表单myproject文件夹。我需要从src推送吗?@Sam,我很确定我几天前在local上修复了这个错误,并在今天创建了git存储库。