How to export (create a migration) a flatpage (.txt) into a database?

472 Views Asked by At

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.

1

There are 1 best solutions below

3
On BEST ANSWER

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