/
Askoline
/
Homework03
Обзор
Документация
Войти
/
Askoline
/
Homework03
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
setup_project.py
56 строк
2 KB
Askoline
first_commit
05 авг 2026, 14:29
05 авг 2026, 14:29
a97374b
Код
Авторство
О чём код?
# -*- coding: utf-8 -*- # setup_project.py # Script to create project structure import os from pathlib import Path def create_project_structure(): """Create the complete project structure""" # Define the project structure structure = { # Root files 'models.py': '', 'config.py': '', 'load_fixtures.py': '', 'create_fixtures.py': '', 'query_publisher_sales.py': '', 'seed_data.py': '', '.env': '', 'requirements.txt': '', 'README.md': '# Book Store Management System\n\nSQLAlchemy project for managing book sales.\n', # Fixtures directory and files 'fixtures/publishers.json': '[]', 'fixtures/shops.json': '[]', 'fixtures/books.json': '[]', 'fixtures/stock.json': '[]', 'fixtures/sales.json': '[]', } # Create directories and files for filepath, content in structure.items(): path = Path(filepath) # Create parent directories if they don't exist path.parent.mkdir(parents=True, exist_ok=True) # Create file with content with open(path, 'w', encoding='utf-8') as f: f.write(content) print(f"Created: {filepath}") print("\n" + "="*50) print("Project structure created successfully!") print("="*50) print("\nNext steps:") print("1. Copy the code into each file") print("2. Install dependencies: pip install -r requirements.txt") print("3. Generate fixtures: python create_fixtures.py") print("4. Load data: python load_fixtures.py") print("5. Test query: python query_publisher_sales.py") if __name__ == "__main__": create_project_structure()