Tuesday, December 15, 2020

Re: Migration of database



Em ter., 15 de dez. de 2020 às 03:40, Dhruvil Shah <sdhruvil72@gmail.com> escreveu:
I have already made my project in Django and used built-in database Sqlite and now I want it in production on heroku so how can I switch all data from Sqlite database to Postgresql database? 



In the source server

python manage.py dumpdata contenttypes --indent=2 --natural-foreign > contenttype.json

python manage.py dumpdata --indent=2 --natural-foreign --exclude contenttypes  > everything_else.json



In the destination server


python manage.py loaddata contenttype.json

python manage.py loaddata everything_else.json



--
  ,= ,-_-. =.   [<o>] Alessandro Madruga Correia
 ((_/)o o(\_))  [http://counter.li.org]       Debian User# 342751 
   `-'(. .)`-'    "O fanatismo é a única forma de força de vontade 
       \_/        acessível aos fracos." (Friedrich Nietzsche)

--
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/CAOofabc9%3DUTOKL%2B6ni5aa_zLGJX5Lruy9HUJ0xcY8VUZB2N5dA%40mail.gmail.com.

No comments:

Post a Comment