Issue
What is the django or pythonic way to setup a folder which contains populations that are applied to both the production database and also to any local database that a user can spin up when working on the django project locally?
Solution
If you want to automatically include initial data you can populate the database using fixtures. Django supports fixtures that are in JSON, YAML or XML. Basically, you can dump database data into fixture files using python manage.py dumpdata or you can create those files manually (or automate it with simple python script) and then with python manage.py loaddata <fixturename> you can populate the database anytime you need it for any environment (production, development etc.).
Django way of storing fixtures is to have folder named fixtures that contains data for the model inside model's application folder.
Find more on this topic in Django Documentation.
Answered By - Aleksandar Mijatović Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.