Skip to main content

No project description provided

Project description

django_beeseeder

PyPI - Django Version License

django_beeseeder is an automated database seeding tool for Django projects. It generates realistic test data for all your models with a single command, making development and testing easier and faster.


Table of Contents


Features

  • 🔄 Automatically discovers your Django models
  • 🤖 Generates realistic dummy data for your models' fields
  • ⚖️ Handles model dependencies and foreign keys
  • 🏷️ Customizable record counts per app or model
  • 🎛️ CLI integration via Django management command
  • ☁️ Supports seeding from remote JSON
  • 🔐 Supports API key-based operations

Installation

You can install django_beeseeder in your Django project using pip:

pip install django_beeseeder

Or, for local development, clone the repo and install in editable mode:

git clone https://github.com/yourusername/django_beeseeder.git
cd django_beeseeder
pip install -e .

Note: Add to your requirements.txt if you want to keep it pinned:

django_beeseeder>=0.1.0

Setup

  1. Add django_beeseeder to your Django project's INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        # ...
        "django_beeseeder",
        # ...
    ]
    
  2. Add the required settings in your settings.py:

    # List the apps you want to be seeded, e.g.:
    SEED_APPS = ["accounts", "your_other_app"]
    
    # API Key for beeseeder (if applicable, e.g. if using external service)
    BEESEEDER_API_KEY = "<your-api-key>"
    

Usage

Run the following command to seed your database:

python manage.py beeseed
  • The command will:
    • Print ASCII art
    • Collect all models in SEED_APPS
    • Generate fake data observing correct model dependency order
    • Insert the generated data into your database

You can customize the number of records, API source, or seeding method in future releases.


Configuration

  • SEED_APPS: List of app labels to be seeded (e.g., ["accounts", "myapp"]).
  • BEESEEDER_API_KEY: Your API key for the beeseeder service (if required).

Example:

SEED_APPS = ["accounts", "products"]
BEESEEDER_API_KEY = "sk-abc123..."

Command Reference

  • python manage.py beeseed
    • Seeds the database with dummy data for all models in SEED_APPS.
    • Prints a summary, and uses provided API key if connecting to external service.

How it Works

  1. Model Collection:
    Collects all models from listed Django apps (SEED_APPS).

  2. Dependency Ordering:
    Orders models based on their interdependencies (foreign keys).

  3. Fake Data Generation:
    For each model, generates realistic fake data for supported field types.

  4. Bulk Insertion:
    Inserts the generated data efficiently via the Django ORM.

  5. Seed From URL (Optional):
    Optionally, you can seed from a remote JSON URL by editing the command code.


Example

Suppose you have accounts and products apps. Set in settings.py:

SEED_APPS = ["accounts", "products"]

Then run:

python manage.py beeseed

The database will be seeded with example data for all models from those apps.


Requirements

  • Python >= 3.8
  • Django >= 5.2.5

Dependencies (see requirements.txt for full list):

  • django
  • faker
  • django-seed

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgements


Happy seeding! 🐝

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_beeseeder-0.1.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_beeseeder-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file django_beeseeder-0.1.1.tar.gz.

File metadata

  • Download URL: django_beeseeder-0.1.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for django_beeseeder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f8558c22dcd95a920c45d0856224842d5f6433cae5a930a60fcd226cbb255486
MD5 aaac06d0fe260ec6733551973f89f695
BLAKE2b-256 d5d7310324c37ef8eb1bd591e5155ae1eb857ea62a65c03dfea59cac80ede857

See more details on using hashes here.

File details

Details for the file django_beeseeder-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_beeseeder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8694ec0464341dca4276a77e40defe0a245b4fb03a5d77a8a8cffe42ca95de4d
MD5 941cbb2f7c3409f1c6fa5889a624973e
BLAKE2b-256 46c569dd3df739182bf35676b4565b378689efde41530ac09cd7d1815b5259c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page