Django迁移到新数据库 [英] Django Migrating to a new Database

查看:135
本文介绍了Django迁移到新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚加入了一个使用Django的项目,并试图初始化我自己的开发服务器。当我尝试这样做时,我的一个应用程序的迁移失败。这个应用程序的一个模型有一个sorl.thumbnail.ImageField,添加一个标志。尝试迁移时,我会收到以下错误消息:

 致命错误 - 以下SQL查询失败:ALTER TABLEaccounts_account ADD CONSTRAINTlogo_id_refs_file_ptr_id_7c3d1997FOREIGN KEY(logo_id)参考filer_image(file_ptr_id)DEFERRABLE INITIALLY DEFERRED; 
错误是:关系filer_image不存在

我不知道什么问题可能是,显然在创建生产数据库或后续的迁移中没有问题。



我相信我已经正确安装了sorl-thumbnail及其所有的依赖项



您的帮助将会非常apperciated。

解决方案

将Johndt6提供的答案从未来的搜索能力的这个答案中拉出来。



解决方案是添加 filer INSTALLED_APPS 元组。


I just joined a project using Django, and am attempting to initialize my own development server. When I attempt to do so, the migration fails for one of my apps. A model for this app has a sorl.thumbnail.ImageField, to add a logo. When the migration is attempted, I get the following error message:

FATAL ERROR - The following SQL query failed: ALTER TABLE "accounts_account" ADD CONSTRAINT "logo_id_refs_file_ptr_id_7c3d1997" FOREIGN KEY ("logo_id") REFERENCES "filer_image" ("file_ptr_id") DEFERRABLE INITIALLY DEFERRED;
The error was: relation "filer_image" does not exist

I'm not sure what the problem could be, as apparently there was no problem in creating the production database or subsequent migrations.

I believe I have correctly installed sorl-thumbnail, and all of its dependencies.

Your help would be much apperciated.

解决方案

I'm pulling the answer provided by Johndt6 from a comment to this answer for future search-ability.

The solution is to add filer to the INSTALLED_APPS tuple.

这篇关于Django迁移到新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆