尝试通过 Elastic Bean 在 AWS 上部署我的应用程序时出错

Posted

技术标签:

【中文标题】尝试通过 Elastic Bean 在 AWS 上部署我的应用程序时出错【英文标题】:Error while trying to deploy my application on AWS via ElasticBean 【发布时间】:2015-04-24 07:06:49 【问题描述】:

我的应用程序在我配置了 PostgreSQL 的本地服务器上运行良好,我也在远程使用 PostgreSQL。

我的几个应用程序使用与用户模型的外键关系,并且我使用了 settings.AUTH_USER_MODEL,正如其他几个答案中所建议的那样。但这并不能解决问题。

我已尝试在数据库即时删除迁移并删除公共架构并重新部署,但仍然没有成功。

这是日志

Traceback (most recent call last):
  File "/opt/python/run/venv/bin/django-admin.py", line 5, in <module>
  management.execute_from_command_line()
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
  utility.execute()
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
  self.execute(*args, **cmd_options)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
  output = self.handle(*args, **options)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
  call_command("migrate", **options)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
  return command.execute(*args, **defaults)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
  output = self.handle(*args, **options)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 179, in handle
  created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 317, in sync_apps
  cursor.execute(statement)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
  return self.cursor.execute(sql, params)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
  six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/python/run/venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
  return self.cursor.execute(sql)
  django.db.utils.ProgrammingError: relation "auth_user" does not exist

在 1.8 中要求运行 syndb,因为它已被弃用?

我正在使用 django 1.8 和 django-social-auth。

谢谢!

【问题讨论】:

检查你的数据库是否包含表auth_user(记住PostgreSQL 区分大小写)代码中的名称和数据库中的表名 不能。显然,由于某种原因,默认情况下迁移不会迁移“auth”。我运行了一个自定义的“django-admin.py migrate auth”并且它工作正常。谢谢! 【参考方案1】:

我通过单独运行解决了问题 django-admin.py migrate auth

默认情况下,显然简单地运行django-admin.py migrate 不会迁移“auth”应用程序。任何想法为什么会发生这种情况?

【讨论】:

以上是关于尝试通过 Elastic Bean 在 AWS 上部署我的应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章

如何通过 ebextensions 在 aws elastic beanstalk 上启用 php-fpm

如何在 AWS Elastic Beanstalk 上设置 HTTPS

如何在 AWS Elastic Beanstalk 上设置 HTTPS

AWS Elastic Beanstalk 部署的 ActionType 在哪里?

将 MongoDB 与 AWS Elastic Bean 应用程序一起使用

让我们在 AWS Elastic Beanstalk 上加密