我使用 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
我做错了什么?
最佳答案
- 在 MySQL 数据库中,从表
'django_migrations'
中删除行'profiles'
。 - 删除迁移文件夹中的所有迁移文件。
- 再试一次
python manage.py makemigrations
和python manage.py migrate
命令。
关于python - Django 1.7 - "No migrations to apply"在 makemigrations 后运行迁移时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25958708/