Integration of Elastic Search and Django(A Python Framework) – Part Two

Share On Facebook
Share On Google Plus
Share On Linkedin
Contact us

In the previous tutorial I made a simple django application, now in this tutorial I will make a custom command that will populate the database with the dummy data. We will use extra modules of the django listed as follows:-

  1. Model Mommy
  2. Faker
  3. django-extensions
  • activate the virtual environnent

  • install model mommy

    install model mommy django

  • same, install faker

  • install django-extensions

    install django extensions

  • add django_extensions to the Installed apps in the

  • Make a sample command

    create sample command using django extensions

    This will make a folder management with the sample command ( in the core folder. Rename this file to say Update the code of the file as:-

    As you see in the above code its is a simple python code to generate the dummy data. I used django-extensions for making the sample command like this one seed_db. model_mommy to prepare and create the objects in the database and faker to generate fake data, like names, email etc. To populate db, save this command file and run the command:-

    100 is the argument as I want to make 100 dummy products. you can pass 1000 to make 1000 products in the database.

    create dummy data in django

I this tutorial we learned about how to create sample command and populate the db with the dummy data. In the next tutorial we will learned about indexing the db with the elasticsearch.

 Thanks for reading this tutorial. For the full code go to my github repo. For more tutorials Keep visiting this site and also check my Git repositories from

2 thoughts on “Integration of Elastic Search and Django(A Python Framework) – Part Two

Leave a Reply

Your email address will not be published. Required fields are marked *