0

I am using Django and created some flatpages via the admin panel, then I export them to my project in a .txt format using:

 python manager.py export_flatpages 1 > my_flat_page.txt

Since I am working remotely, I need my peers to be able to quickly migrate those .txt files to their local database.

Any idea about how can I create this migration?

PS>

I already read this https://docs.djangoproject.com/es/1.9/topics/migrations/, but did not get how to relate .txt to migrations.

carlosbvz
  • 163
  • 2
  • 14
  • Are you sure you used `manage.py export_flatpages` to create the txt file? I'm not aware of this django command. Did you use `dumpdata`? – ilse2005 Feb 17 '16 at 22:33
  • Hi, Yes, I exported them and saved as separated .txt files. The interesting part of this is that it uses an "Django format" (I assume), not json. – carlosbvz Feb 17 '16 at 23:50

1 Answers1

2

You can do the following to export flatpages from your db (https://docs.djangoproject.com/es/1.9/ref/django-admin/#django-admin-dumpdata)

python manage.py dumpdata flatpages > flatpages.json

And then load this flatpages.json using (https://docs.djangoproject.com/es/1.9/howto/initial-data/)

python manage.py loaddata flatpages.json
ilse2005
  • 11,189
  • 5
  • 51
  • 75