Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku未运行django迁移_Django_Heroku - Fatal编程技术网

Heroku未运行django迁移

Heroku未运行django迁移,django,heroku,Django,Heroku,我有一个运行在Heroku上的Django应用程序。我正在将Postgres与Django一起使用,当我第一次提交文件并运行heroku run python manage.py migrate时,初始迁移工作正常。然后我创建了一个新的应用程序餐厅,在其中我创建了一个新模型 我运行了本地makemigrations和migrate,它创建了一个新文件restaurant/migrations/0001_initial.py 问题是,当我现在运行heroku run python manage.p

我有一个运行在Heroku上的
Django
应用程序。我正在将
Postgres
Django
一起使用,当我第一次提交文件并运行
heroku run python manage.py migrate
时,初始迁移工作正常。然后我创建了一个新的应用程序
餐厅
,在其中我创建了一个新模型

我运行了本地
makemigrations
migrate
,它创建了一个新文件
restaurant/migrations/0001_initial.py

问题是,当我现在运行
heroku run python manage.py migrate
时,它说没有要应用的迁移。我试过了

heroku运行python manage.py迁移餐厅

但有一个错误
CommandError:应用程序“餐厅”没有迁移。

我已经登录到控制台,迁移文件在那里,因此我想知道是否应该执行以下操作:

heroku run python manage.py makemigrations
heroku run python manage.py migrate
我使用项目作为基础,只修改了设置,以便

DATABASES = {
'default': dj_database_url.config()
}

在migrations文件夹中,您还需要包含
\uu init\uuuupy.py
,否则
Heroku
会将应用程序视为没有任何迁移。

首先,确保您已将迁移文件提交到存储库中。您是否添加并提交了迁移文件?另外,您不应该在heroku上运行
makemigrations
命令,您必须在本地运行该命令。如上所述,我已经登录到heroku控制台并验证文件是否存在。但这意味着什么?你到底做了什么来“验证文件是否存在”?您没有列出将文件添加到git repo、提交和部署应用程序的步骤;是你干的吗?