2

I am totally new to hosting/deploying applications. After watching this video, he started a new database from scratch rather than converting his Django SQLite database. I have lots of data that I want on the deployed site so I'd like some advice as to how to do that with Django and Heroku. I have seen there are some SQLite -> PostGreSQL conversion questions on here but none seemed to show a step by step guide using Django and Heroku, only issues they're having. I just want to make sure I do it right.

2
  • 2
    Here are some tips: Use the same database server in development as you are in production. Don't consider data in your database part of your application—data generally shouldn't be the same in multiple environments. If you need to add production data, do it in your production database. You can try using dumpdata and loaddata, but you might run into issues. Also, see: docs.djangoproject.com/en/2.1/topics/serialization Commented Feb 22, 2019 at 14:56
  • But really this question isn't about converting from sqlite to Postgres, but about copying your data from development to production. Commented Feb 22, 2019 at 15:44

1 Answer 1

2

One easy solution could be using dumpdata and loaddata management commands from Django.

For example, locally you would do:

$ python manage.py dumpdata > somefile

then on your deployment you could do:

$ python manage.py loaddata somefile

This is not the ideal solution, but for simple use cases could definitely do the trick.

Note: you would have to first upload the somefile to your server, in this case heroku.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.