I'm starting to use the "redirects" app built into Django to replace some existing redirects I have in my urls.py. I was wondering if there was any generally accepted way to include initial data in the code base for other apps. For example, if it was for an app I created I could create a migration file that had a RunPython section where I could load some initial data. With a built-in or third-party app there doesn't seem to be any way to create a migration file to add initial data.
The best I can think of right now is to include a .sql file in my repository with the initial data and just manually import the data as I push the code to the different instances.
you can do it by using fixtures
create a folder name fixtures in your app directory
use this command to create a json file that you want to make as initial data.
python manage.py dumpdata you_app_name.model_name --indent 2 > model_name.json
copy this model_name.json to fixtures folder.
upload the code to the repo.
then after the migrate command . Type this command to load the initial data.
python manage.py loaddata model_name.json