Skip to content

AnSiChen/python_db_populator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Automated Database Populator

Video Demo: https://youtu.be/enrY6JeYuJE

Description

Automated Database Populator Python-based tool designed to automatically generate and populate data for a Django Book Management System. This project was developed as part of the CS50 Python course. My goal was to demonstrate the ability to automate tasks in a web-based application, also created by myself.

Project Files

  • db_populator.py: It contains functions to connect to the Django database, create genres, books, users, and their profiles. Each function is responsible for generating random but coherent data to populate the database.
    • connect_to_db(): Sets up the connection to the Django database.
    • create_genres(): Populates the database with a predefined list of book genres.
    • create_books(): Generates and adds books with randomly generated titles, authors, and other relevant details.
    • create_users(): Creates user accounts along with their profiles, including a default profile picture and a personalized bio. -README.mdfile: This readme file
  • requirements.txt

Design Choices

One of the critical design decisions in this project was choosing to generate random data for books and users instead of scraping content from external sources. This approach was taken to avoid any issues related to the collection or generation of sensitive data, ensuring the project remains ethical and privacy-focused.

The project uses the Faker library to create realistic names, titles, and other text-based data. For image generation, the Pillow library is used to create unique book covers with random shapes and colors. This approach provides a diverse range of data, making the book management system feel more authentic for demonstration purposes.

User and Profile Generation

The create_users function also associates each account with a profile. The profile includes a preset bio template that incorporates the user's username to personalize the experience. Additionally, a default profile picture is assigned to each profile, ensuring that every account has a complete set of data.

The Automated Database Populator uses scripting to automate the process of data generation in web applications. It's a practical tool for quickly setting up a rich dataset for a book management system.

About

Python utility for generating realistic books, users, genres, and images to seed Django databases for development and testing.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages