syncdb在第三方项目中不添加灯具 [英] syncdb not adding fixtures in 3rd party project

查看:116
本文介绍了syncdb在第三方项目中不添加灯具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个非常简单的Django应用程序,名为 django-locality与国家和地区合作。它为国家和地区提供了大量初始数据。我只是0.1发布到PyPI,并将其安装在我正在进行的项目中。 (我基本上是在我原来的项目中找到的)。

I've written a pretty simple Django application called django-locality which takes the headache out of working with countries and territories. It provides a lot of initial data for countries and territories. I just the 0.1 release up to PyPI, and installed it in my project which I'm currently working on. (I basically created it out of a need I found in my original project.)

当我运行 syncdb 但是,它没有从 locality 安装任何我的装置。在输出中,它打印找不到灯具,并且没有行被添加到数据库,尽管生成表。 Django是否缺少我的初始数据?我的数据生活在 locality / fixtures / initial_data.json ,如果从自己的专用项目运行,安装就好了。当我使用setuptools来管理依赖项时,如果我将它下载到一个压缩的蛋,而不是一个简单的目录布局,会有所不同吗?

When I ran syncdb, however, it didn't install any of my fixtures from locality. In the output, it printed "No fixtures found," and no rows were added to the database, though the tables were generated. Is there a reason why Django is missing my initial data? My data lives at locality/fixtures/initial_data.json and installs just fine if running it from it's own dedicated project. As I'm using setuptools to manage dependencies, would it make a difference if I downloaded it as a zipped egg vs. a simple directory layout?

最初,似乎我的JSON没有被包含在egg中,这就是为什么 syncdb 没有工作。现在,我已经解决了这个问题,但是 c> syncdb 仍然是找不到我的装置。您可以下载蛋以查看自己 here 。我不能想到Django会丢失初始数据的任何原因。您还可以在GitHub上查看存储库。为什么Django看不到灯具?

Initially, it seems that my JSON wasn't being included in the egg, and this is why syncdb didn't work. Now, I've fixed that problem, but syncdb is still failing to find any of my fixtures. You can download the egg to see for yourself here. I can't think of any reason why Django would be missing the initial data. You can also view the repository on GitHub. Why isn't Django seeing the fixtures?

当我运行 syncdb -v 2 Django看到了这个鸡蛋,找到了这个灯具:

When I run syncdb -v 2, I do see that Django sees the egg and looks for the fixtures:

No json fixture 'initial_data' in '/home/rfkrocktk/Desktop/myproject/eggs/django_locality-0.1.1-py2.7.egg/locality/fixtures'.

Django是否可能不知道如何从鸡蛋中读取?

Is it possible that Django doesn't know how to read from eggs?

推荐答案

好的,事实证明,Django 不知道如何查看压缩的egg文件。 em>一旦我将蛋文件提取到一个名称为目录的东西,事情就起作用了。

Ok, as it turns out, Django doesn't know how to look inside zipped egg files. As soon as I extracted the egg file to a directory with its name, things worked.

这篇关于syncdb在第三方项目中不添加灯具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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