Search code examples
djangodjango-fixtures

Install Django fixture from URL


I've got a few rather large fixtures of static data (about 20MB each) that I'd like to keep out of my repo to keep the repo size under control. Is there any way to load fixtures from a URL? I took a long shot and pushed my fixture up to S3 in hopes that the following would work, but no luck.

python manage.py loaddata http://s3.amazonaws.com/path/to/fixtures/initial_stuff.json

Does anyone have any ideas for install fixtures via HTTP?


Solution

  • Have you tried using curl and xargs?

    curl http://s3.amazonaws.com/path/to/fixtures/initial_stuff.json | xargs python manage.py loaddata
    

    If that doesn't work, I suppose you'll have to dump it to a file and then loaddata.

    curl http://s3.amazonaws.com/path/to/fixtures/initial_stuff.json > tmp.json
    python manage.py loaddata tmp.json