- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
Python 2.7 版Django 版本 1.9.7
我在 heroku 上创建了一个 Django 应用程序。我无法让 heroku 服务器正确地迁移
。过去,我在本地完成了所有的makemigrations
,然后将它们推送到服务器。它在过去有效。现在我想我会选择在服务器端进行所有迁移,因为我根本没有在本地运行这个应用程序。
我刚刚在 models.py
中为应用“main”创建了一个新模型:
from __future__ import unicode_literals
from django.db import models
class InstagramPhotos(models.Model):
imageId = models.IntegerField()
userId = models.IntegerField()
likes = models.IntegerField()
captionText = models.CharField(max_length=200)
image = models.ImageField()
将更改推送到服务器后,我运行了它,输出如下:
heroku run python manage.py makemigrations main
Running python manage.py makemigrations main on ⬢ glacial-beach-50253... up, run.8354 Migrations for 'main':
0001_initial.py: - Create model InstagramPhotos
看起来还可以吧?因此,我尝试迁移
,如您所知,这实际上会在数据库中创建表:
heroku run python manage.py migrate
Running python manage.py migrate on ⬢ glacial-beach-50253... up, run.7556 Operations to perform: Apply all migrations: auth, contenttypes, admin, sessions Running migrations: No migrations to apply. Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
无论我尝试重新运行 makemigrations
和 migrate
多少次,它似乎仍然无法正常运行。除了无法以这种方式在 heroku 服务器上运行外,不确定为什么会发生这种情况?我是否一定需要在本地执行 makemigrations
并推送?
仅供引用,我只是在 settings.py
中定义了默认的 sqlite3 数据库。
最佳答案
我遇到了类似的问题。
我只是通过 ssh
进入 heroku dyno:heroku run bash
(来自您的 heroku 应用程序文件夹 ofc)
然后在需要时使用 createsuperuser 运行所有迁移和 makemigration 命令。为我使用 sqlite 和 postgre。
关于python - heroku 服务器上的 django makemigrations 和 migrate 不创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38330432/
因此,我正在使用 rails(ruby 1.9.3p392、rails 3.2、sqlite3 db)并尝试将无处不在的博客教程代码部署到“生产”服务器(apache、passenger、ubuntu
我继承了一个项目,该项目设置为使用 Entity Framework 在新数据库上设置数据库架构。 该项目最初有两个不同的文件夹——默认的/Migrations 文件夹和另一个文件夹——带有 DbMi
我在我的 Nest 应用程序上运行这行代码: import * as typeOrm from "../node_modules/typeorm/index"; bootstrap(){ //
我需要像下面的代码一样创建一个外键: Create.ForeignKey().FromTable("TCGDocFiscalOpMedItem").ForeignColumn("IDCabecalho
如何从扩展 Migration 的类的 Up(或 Down)方法中获取迁移正在操作的数据库的名称 public class BaseMigration : Migration { public
我们已将迁移添加到我们的xamarin表单项目中,此后我们就无法将其部署到iOS设备上。它可以在模拟器上正常运行,但在部署到设备时会因AOT错误而失败。 这似乎是一个在网络上广泛传播的话题,但是到目前
我正在尝试自己研究 Fluent Migrator,但我遇到了一个问题,我需要更改由 Fluent Migrator 创建的表的结构,这意味着我使用以下代码创建了一个名为 user 的表 [Migr
我正在使用 PostgreSQL、Rails 3.1.3 和 Ruby 1.9.3。我正在努力使用 db:migrate 概述 here . 这是我在终端中看到的: funkdified@funkdi
我决定使用 gorm作为我的 ORM。我想使用 golang-migrate/migrate 进行迁移因为,看起来 GORM 没有版本化迁移文件。我宁愿使用 CLI 进行迁移,而不是使用自动迁移。 我
我正在针对现有 SQL Server 数据库设置 EF Core 3.1.3 迁移。 这是我到目前为止所做的: 从现有数据库搭建我的模型。 添加 InitialCreate 迁移。 删除 Initia
我正在玩 Entity Framework 和持续构建。到目前为止,通过使用 migrate.exe 和适当的参数,我能够毫无问题地运行迁移或一系列迁移。 但是,我在尝试让 migrate.exe 踢
我正在使用包管理器控制台向我的数据库添加迁移,但由于某种原因它只是卡住并且什么也不做。停止它并继续使用它的唯一方法是使用任务管理器关闭 Visual Studio。这是一个已知问题吗? 最佳答案 我不
我在sequelize上运行帮助命令,发现有两个不同的命令具有相同的描述: $ sequelize help:migration:create Sequelize [Node: 6.9.5, CLI:
在这里,我使用的是 Microsoft Azure。 其中,我正在尝试使用开源 DocumentDB 数据迁移工具将数据从各种来源导入 Microsoft Azure DocumentDB,包括 JS
我是 Laravel 的新手。 我正在开发 Laravel 版本 6。 我已经创建了迁移。 第一次运行良好,但如果我更改迁移文件中的某些内容,然后运行 php artisan migrate它显示
我已经使用 NuGet 安装了 Migrator.NET,但是当我尝试使用 MSBuild 运行迁移时,出现以下错误。我看到它在访问 Migrator.Framework 程序集时遇到问题,但我不确定
我有一个基于 miguel flask tutorial 的网络应用程序 所以我将 sqlalchemy-migrate 用于数据库,现在我应该在迁移中使用 Alembic 我该如何配置?有什么方法可
我已经尝试执行 cli 命令 ./doctrine generate-migrations-diff 并在正确的文件夹中正确创建了一个版本文件。 消息是:generate-migrations-dif
可以定义存储迁移的多个路径: doctrine_migrations.yaml doctrine_migrations: migrations_paths: 'App\Migr
我在我的 .Net 应用程序中使用 Fluent Migrator 1.6.2。 对于数据库的上迁移或下迁移,需要通过命令行传递汇编文件(迁移类所在的数据库工程的dll文件)来执行Migrate.ex
我是一名优秀的程序员,十分优秀!