Spaces:
Running
Running
Download api/seeding/practice_runner.py from Dayozoe/harvestconnect-api: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/Dayozoe/harvestconnect-api/resolve/main/api/seeding/practice_runner.py
- Command line
-
hf download hf://spaces/Dayozoe/harvestconnect-api/api/seeding/practice_runner.py
-
curl -L -o practice_runner.py https://huggingface.co/spaces/Dayozoe/harvestconnect-api/resolve/main/api/seeding/practice_runner.py
1.09 kB
| from api.models import Product, BlogPost, Review | |
| from .practice_cleanup import clear_practice_data | |
| from .practice_users import create_practice_users, PASSWORD | |
| from .practice_catalog import create_categories, create_practice_products | |
| from .practice_content import create_articles, create_reviews | |
| from .practice_artists import create_practice_artists | |
| def run_practice_seed(command): | |
| clear_practice_data(command) | |
| categories = create_categories() | |
| users, sellers, buyer = create_practice_users(command) | |
| products = create_practice_products(command, users, categories) | |
| create_articles(command, sellers) | |
| create_reviews(products, buyer) | |
| create_practice_artists(users) | |
| command.stdout.write(command.style.SUCCESS('Successfully seeded practice database.')) | |
| command.stdout.write(f'Marketplace: {Product.objects.count()} active listings') | |
| command.stdout.write(f'Articles: {BlogPost.objects.count()} published posts') | |
| command.stdout.write(f'Reviews: {Review.objects.count()} customer reviews') | |
| command.stdout.write(f'Practice accounts password: {PASSWORD}') | |