Tuesday, July 28, 2020

Re: Django MySQL database backup and restore to new server

Thanks a lot! Solved my 

django.db.utils.IntegrityError: Problem installing fixture ... duplicate key value violates unique constraint

problem :)



W dniu wtorek, 5 maja 2020 18:24:12 UTC+2 użytkownik marc bellazzini napisał:
SOLVED

# after more extensive googling .....

ORIGINAL SERVER
- cd to your web project directory
- python manage.py dumpdata > db.json

NEW SERVER
- sftp db.json file to new server web project directory
- python manage.py migrate
- python manage.py shell
-- >> from django.contrib.contenttypes.models import ContentType
-- >> ContentType.objects.all().delete()
-- >> quit()
- sftp db.json file to new server web project directory
- python manage.py loaddata db.json


On Monday, May 4, 2020 at 4:53:29 PM UTC-5, marc bellazzini wrote:
Hello, 

I have Django 2.x running on an old Ubuntu server with a MySQL database. I have installed a new Ubuntu 20.04 server on another machine with Django 3.x and MySQL. I would like to backup the old Django/mysql database and restore it on the new server. What is the best practice for doing this? 

Thanks

Marc
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2c3043d8-02d1-4d44-9b2c-e6d86c8a4720o%40googlegroups.com.

1 comment: