SO I have Two django projects Old and New. I Have setup everything in new same to old one. How do I get Entries in database from old to new ? I tried copy pasting the migrations folder and dbsqlite file. Is there another way ?
Asked
Active
Viewed 29 times
0
-
Are you using sqllite? or postgresql, mysql? – Anup Yadav Mar 30 '18 at 05:48
-
I have a db named SQLITE3 file in django directory – Arjun Kashyap Mar 30 '18 at 05:50
-
Then copy old project's `.sqlite` file to new one. that's it. Keep setting as it is, if you want to convert to another database like mysql or postgresql. Then I would recommend dump to json and use fixures. OR in same case you can do dump to json file and use fixture in SQLLITE too. – Anup Yadav Mar 30 '18 at 05:54
-
https://stackoverflow.com/questions/3476606/django-what-are-the-best-practices-to-migrate-a-project-from-sqlite-to-posgresq This post can help you more. – Anup Yadav Mar 30 '18 at 05:55
-
Your method did work. But If I Run migrations, my dabase again vanishses. – Arjun Kashyap Mar 30 '18 at 06:13
-
May be copy migrations folders with all files. – Anup Yadav Mar 30 '18 at 06:33
-
You should try to run ```python manage.py dumpdata -o dump.json``` from your old project and then ```python manage.py loaddata dump.json``` from your new project. – May.D Mar 30 '18 at 08:52