我正在使用CLI将Django应用程序部署到AWS EB,并注意到EB第一次没有看到新的迁移文件。所以,当我有新的迁移时,我需要部署两次。我查看了日志,确实第一次找不到迁移,第二次发现。这是我的迁移代码:
container_commands:
01_migrate:
command: "django-admin.py migrate"
leader_only: true
02_collectstatic:
command: "python ras-server/manage.py collectstatic --noinput"
我需要更改命令顺序吗?此外,我认为,当我从Jenkins部署时,问题可能出在Jenkins身上。有什么建议?
问题出在Jenkins身上:出于某种原因,当我使用第一次找不到的执行shell迁移进行部署时。解决方案是使用Elastic Beanstalk Deployment plugin。此外,使用插件部署所需的时间更少。
同样的错误对我来说。就我而言。我忘了在迁移中包含App名称。尝试包括应用程序名称考试
01_migrate:
command: "python manage.py makemigrations exams --noinput"
command: "python manage.py migrate exams --noinput"
leader_only: true