迁移未检测到弹性豆茎上的变化

问题描述 投票:0回答:1

我正在Elastic Beanstalk上运行Django 1.11应用。

我将模型Profile作为应用grams的一部分,并将字段email_verified添加到模型中。当我在本地进行makemigrations时,它会立即拿起零钱。当我使用eb deploy推送到弹性beantalk时,它将运行makemigrations但未发现任何更改,然后运行migration并且未发现任何更改。

此服务器已经运行了几个月,并且已经成功进行了多次迁移。

这里是部署后尝试登录后的错误消息。

    Internal Server Error: /signin/
    Traceback (most recent call last):
      File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 385, in __get__
        rel_obj = getattr(instance, self.cache_name)
    AttributeError: 'User' object has no attribute '_profile_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column grams_profile.email_verified does not exist
LINE 1: ...ofile"."user_id", "grams_profile"."phone_number", "grams_pro...

这里是部署脚本:

container_commands:
  01_makemigrations:
    command: "source /opt/python/run/venv/bin/activate && python manage.py makemigrations --noinput"
    leader_only: true

  02_makemigrationsgrams:
    command: "source /opt/python/run/venv/bin/activate && python manage.py makemigrations grams --noinput"
    leader_only: true

  03_migrate:
    command: "source /opt/python/run/venv/bin/activate && python manage.py migrate --noinput"
    leader_only: true

  04_createsu:
    command: "source /opt/python/run/venv/bin/activate && python manage.py createsu"
    leader_only: true

  05_collectstatic:
    command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput"
    leader_only: true

option_settings:
  - namespace: aws:elasticbeanstalk:container:python:staticfiles
    option_name: /static/
    value: static/

packages:
  yum:
    postgresql95-devel: []

files:
  "/opt/python/log/django.log" :
    mode: "000666"
    owner: ec2-user
    group: ec2-user
    content: |
      # Django Log File

  "/etc/httpd/conf.d/wsgi_custom.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
       WSGIPassAuthorization On

请让我知道我可以提供帮助的其他信息。

django postgresql amazon-web-services amazon-elastic-beanstalk
1个回答
0
投票

@@ Daniel Roseman是正确的!

我从我的.ebignore文件中删除了// migrations /,但将其保留在我的.gitignore文件中,以确保它们不会出现在git中。

现在一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.