Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loaddata of example got errors #7

Closed
gorf opened this issue Jun 25, 2012 · 4 comments
Closed

loaddata of example got errors #7

gorf opened this issue Jun 25, 2012 · 4 comments

Comments

@gorf
Copy link

gorf commented Jun 25, 2012

I config the example.
when I run python manage.py loaddata open_news/open_news.json
I got the errors below:

$ python manage.py loaddata open_news/open_news.json
Problem installing fixture 'open_news/open_news.json': Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/django/core/management/commands/loaddata.py", line 196, in handle
obj.save(using=using)
File "/usr/lib64/python2.7/site-packages/django/core/serializers/base.py", line 165, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/usr/lib64/python2.7/site-packages/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/lib64/python2.7/site-packages/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/usr/lib64/python2.7/site-packages/django/db/models/query.py", line 1576, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/lib64/python2.7/site-packages/django/db/models/sql/compiler.py", line 910, in execute_sql
cursor.execute(sql, params)
File "/usr/lib64/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/usr/lib64/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
IntegrityError: Could not load contenttypes.ContentType(pk=25): columns app_label, model are not unique

What's wrong with it ?

@holgerd77
Copy link
Owner

Hi, I just commited the 0.2 version a couple of days ago, are you using this new version? Actually the example project was broken before in 0.1.x, that was one thing I fixed. I also updated the project layout to Django 1.4, so you need this new Django version to get the example up and running.

@gorf
Copy link
Author

gorf commented Jun 25, 2012

Thanks for your rapid reply.
My django is 1.4, The example in DDS version 0.1 can loaddata normally. And
I can run it after fix a little. But the newest 0.2 cause the error.

On Mon, Jun 25, 2012 at 9:56 PM, Holger Drewes <
reply@reply.github.com

wrote:

Hi, I just commited the 0.2 version a couple of days ago, are you using
this new version? Actually the example project was broken before in 0.1.x,
that was one thing I fixed. I also updated the project layout to Django
1.4, so you need this new Django version to get the example up and running.


Reply to this email directly or view it on GitHub:

#7 (comment)

Best regards,

Gorf Liu

@holgerd77
Copy link
Owner

Hi, I think I found the problem, I was creating the example data with automatically generated objects by Django, which can be problematic (see: https://docs.djangoproject.com/en/dev/topics/serialization/#natural-keys). I just created a new fixture and committed it to GitHub: https://github.com/holgerd77/django-dynamic-scraper/blob/master/example_project/open_news/open_news.json just containing the essential app data. If you use that file for loaddata, I assume it should work. Would be nice, if you give some short feedback!

@gorf
Copy link
Author

gorf commented Jun 27, 2012

It's ok now.

@gorf gorf closed this as completed Jun 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants