我正试着在Heroku上上传我的django应用程序。它在本地可以工作,因为我纠正了错误,但由于某种原因,我添加了whitenoise来获取本地文件,以便可以在Heroku上部署,但它总是出现相同的错误。我正在加载一个本地包csv-imports,它在第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给出的正确文件路径上,我的计算机上没有应用程序/.heroku/。但是,在我的电脑上只有一个csv-imports的安装,而且那个已经被修复了。为什么我一直收到这个错误,我如何修复它?
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: 发布于 2019-03-03 11:38:53
如果你的静态目录有问题,首先你必须运行:"python manage.py“这会给你静态目录的路径,或者是一个异常,就像你使用没有STATIC_ROOT目录的STATIC_URL。
https://stackoverflow.com/questions/54917645
复制相似问题