python - Django 1.7 - "No migrations to apply"在 makemigrations 后运行迁移时

标签 python django

我使用 Django1.7 和 Mezzanine。我创建了存储在单独的应用程序“配置文件”中的简单配置文件(根据夹层文档):

class RoadmapProfile(models.Model):
    user = models.OneToOneField("auth.User")
    fullname = models.CharField(max_length=100, verbose_name="Full name")

创建迁移返回:

  Migrations for 'profiles':
      0001_initial.py:
        - Create model RoadmapProfile

当我运行“迁移配置文件”时:

Operations to perform:
  Apply all migrations: profiles
Running migrations:
  No migrations to apply.

问题是,当我尝试打开任何与 mezzanine.accounts 相关的页面(例如更新帐户)时,它会崩溃:

OperationalError at /accounts/update/

no such column: profiles_roadmapprofile.fullname

我做错了什么?

最佳答案

  1. 在 MySQL 数据库中,从表 'django_migrations' 中删除行 'profiles'
  2. 删除迁移文件夹中的所有迁移文件。
  3. 再试一次 python manage.py makemigrationspython manage.py migrate 命令。

关于python - Django 1.7 - "No migrations to apply"在 makemigrations 后运行迁移时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25958708/

相关文章:

Python:删除希腊变音符号/口音

python - 部署代码时如何使用python flask 获取公共(public)和私有(private)IP地址?

python - 读取 Pandas 的季度数据

Django 仍然使用 @never_cache 装饰器缓存 View

python - Django:如何添加复选框?

python - 在 django 中创建正则表达式

具有多维 numpy 数组的 python 数据结构

python - 调整大小时使用 PIL 保留图像的 exif 数据(创建缩略图)

django - 计算时间段的平均汇率

python - Python 3 中的 Django 问题 "super() argument 1 must be type, not WSGIRequest"