You can use Django's native manage.py command instead:
Inside of your yourapp directory, create the tree structure (including the folder management), like so:
yourapp
├── admin.py
├── __init__.py
├── management
│ ├── commands
│ │ ├── __init__.py
│ │ └── populate_db.py
│ └── __init__.py
├── models.py
... other files
Then, inside the file populate_db.py write the appropriate code to populate your database, e.g.:
from django.core.management.base import BaseCommand
from yourapp.models import Post, Tag
class Command(BaseCommand):
args = '<foo bar ...>'
help = 'our help string comes here'
def _create_tags(self):
tlisp = Tag(name='Python')
tlisp.save()
tjava = Tag(name='Java')
tjava.save()
def handle(self, *args, **options):
self._create_tags()
With this setup you can run $ python manage.py populate_db to automatically populate your database.
And of course you can expand this code to read input from e.g. a JSON file that you can keep in a data folder of your app. This allows you to commit non-sensible data that should be part of your app to version control without having to compromise the database (and thereby potentially your superuser access).
Credit for this elegant solution goes to Eli Bendersky: https://eli.thegreenplace.net/2014/02/15/programmatically-populating-a-django-database
sqlite3,sqlalchemy,peewee. Or you can try to convertJSONintoCSVand then import directly to database using some Database Viewer/Editor. I don'ty know if they can import data directly fromJSON- ie. DB Browser for SQLite