Forums

Populating Database in Production

I recently learnt that I shouldn't be commiting and pushing my sqlite3 database to my repository. So I added it to my .gitignore file and made the changes. As expected, now in my live website, I don't have a superuser account, and all my blogs and projects are also empty.

My question is more of trying to clarify and understand how to manage databases in production. from this post, I understood that on PW, I am essentially using a separate database than the one in my local computer. I understand I should be making static/code changes from my local machine and following the steps outlined to apply those changes in my PW database (I already do this ).

The only part that confuses me now is how I should be adding database objects(blog posts, user accounts,etc) in production. Previously , since I pushed my sqlite3 database, I would add posts and create accounts from my local machine, follow the steps to apply changes in the live website while being oblivious to the fact those steps weren't actually updating the content of my database. Now that my local database is no longer being pushed, does that mean that I should have and now should be creating superusers/user accounts, blog posts and any other dynamic content from the bash console / live server admin dashboard? And that since the database is listed in the .gitignore, the content I added in here will not be pushed to the repository.

I hope you can help me clarify my confusion. Thank you.

If git is ignoring your sqlite file, then you will need to create everything in the production database that you want to include in the production database. You can either do that from a manage.py shell or through the admin interface on the production site. Any content that you create on the development database will not be mirrored in the production database.