【问题标题】:How do you view your PostgreSQL database and tables that are part of a Django app that has been uploaded to Heroku?您如何查看已上传到 Heroku 的 Django 应用程序中的 PostgreSQL 数据库和表?
【发布时间】:2020-07-28 10:43:52
【问题描述】:
  1. 在本地构建 Django 应用程序。运行良好。
  2. 上传到 Heroku,似乎成功了。
  3. 但是“用户”表显然已损坏。我无法在 Heroku 上的 Django 应用程序上登录或创建没有错误的用户。
  4. 我想修改(特别是删除)Heroku 上 PostgreSQL 数据库的“用户”表中的行。我怎样才能做到这一点?
  5. 我从 CLI 运行以下命令但没有成功:
    heroku 运行 python manage.py makemigrations
    heroku 运行 python manage.py 迁移

【问题讨论】:

  • ".... 没有成功"。你有什么?错误信息?追溯?

标签: python django postgresql heroku


【解决方案1】:

我会建议以下步骤:

  1. 打开 Heroku 进入项目页面,点击资源。
  2. 在 Add-ons 下,您会找到 Heroku postgres(即您是 数据库)按下它。
  3. 在数据库转到设置获取凭据并连接到您的 通过使用 pg-Admin 连接到 Heroku 数据库来使用数据库 pg-Admin。
  4. 在 pg-Admin 中设置 Heroku 数据库的凭据,但请不要 忘记提前设置 DB 限制选项卡以仅连接到 您在 Heroku 上的数据库,否则,您将获得您的数据库列表 不知道为什么。 现在您可以使用 pgadmin 在 heroku 上使用您的远程数据库。 请检查以下图片以了解 pgadmin 中的配置服务器

enter image description here enter image description here

【讨论】:

    猜你喜欢
    • 2014-02-20
    • 1970-01-01
    • 2012-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-04
    • 1970-01-01
    • 2013-05-27
    相关资源
    最近更新 更多