I typically dump all of my apps individually, and load them
individually. Unfortunately finding out where/why imports break with
loaddata is problematic without inserting some debugging code in your
django stack. Hence, I dump all my stuff individually, and I can at
least somewhat narrow down what's breaking the importer.

On Nov 18, 7:59 pm, Sachi <[email protected]> wrote:
> Hi, all,
>
> I have been developing a website, where I use the same postgresql
> database server for both development and production. Now that I have
> had many users and a significant amount of data, I am trying to use
> sqlite3 engine when I do development locally instead of connecting to
> the production server. In my settings.py, I have something that looks
> like:
>
> if ON_PRODUCTION_SERVER: DATABASE_ENGINE  = "postgresql_psycopg2" ...
> else: DATABASE_ENGINE = "sqlite3" ...
>
> My task right now is to dump data (I wish to dump all of them) from
> the production server, and install them in the local sqlite database.
> This is what I did:
>
> python manage.py dumpdata > data.json
>
> Then, I switched to sqlite3 database, and did
>
> python manage.py syncdb
> python manage.py loaddata data.json
>
> However, I met the following errors:
>
> Installing json fixture 'data' from absolute path.
> Problem installing fixture 'data.json': Traceback (most recent call
> last):
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/core/management/commands/loaddata.py",
> line 153, in handle
>     obj.save()
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/core/serializers/base.py", line 163, in
> save
>     models.Model.save_base(self.object, raw=True)
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/db/models/base.py", line 474, in
> save_base
>     rows = manager.filter(pk=pk_val)._update(values)
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/db/models/query.py", line 444, in
> _update
>     return query.execute_sql(None)
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/db/models/sql/subqueries.py", line 120,
> in execute_sql
>     cursor = super(UpdateQuery, self).execute_sql(result_type)
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/db/models/sql/query.py", line 2369, in
> execute_sql
>     cursor.execute(sql, params)
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/db/backends/util.py", line 19, in
> execute
>     return self.cursor.execute(sql, params)
>   File "/Users/sachi/Workspace/socialmobility/pinax/pinax-env/lib/
> python2.6/site-packages/django/db/backends/sqlite3/base.py", line 193,
> in execute
>     return Database.Cursor.execute(self, query, params)
> IntegrityError: columns app_label, model are not unique
>
> Could anybody let me know why this error happened, and how I get
> correctly dump/load data?
>
> Thanks a lot!
>
> Sachi

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.


Reply via email to