Skip to main content

@@⚠️ Caution: This library is under heavy development and is not ready for production.

@@# DjangoWiz

@@DjangoWiz is a simple and powerful toolkit to automate the generation of serializers, viewsets, URLs, and Docker configurations for your Django projects. This toolkit helps you quickly scaffold out necessary files based on your models, saving you time and effort.

@@## Features

@@- Automatically generates serializers, viewsets, and URLs based on your Django models. @@- Supports generation of Dockerfile and Docker Compose configurations for development and production environments. @@- Skips non-serializable classes and abstract models. @@- Includes customizable templates using Jinja2. @@- Provides flexible commands to generate different components individually or all together. @@- Supports custom templates and single file mode. @@- Can be used in other Python scripts.

@@## Installation

@@1. Install via pip: @@ bash @@ pip install DjangoWiz @@

@@2. Alternatively, clone the repository: @@ bash @@ git clone https://github.com/tavallie/DjangoWiz.git @@ cd DjangoWiz @@

@@3. Install dependencies: @@ Ensure you have Python and Poetry installed, then run: @@ bash @@ poetry install @@

@@## Usage

@@### Generate All Files

@@Generate serializers, viewsets, routes, URLs, Dockerfile, and Docker Compose configurations:

@@bash @@djangowiz generate_files <your_app> <your_project> <path/to/models.py> --overwrite @@

@@### Generate Core Files Only

@@Generate serializers, viewsets, and routes without Docker-related files:

@@bash @@djangowiz generate_core_files <your_app> <your_project> <path/to/models.py> --overwrite @@

@@### Generate Individual Components

@@#### Generate Serializers

@@bash @@djangowiz generate_serializers <your_app> <your_project> <path/to/models.py> --overwrite @@

@@#### Generate Viewsets

@@bash @@djangowiz generate_viewsets <your_app> <your_project> <path/to/models.py> --overwrite @@

@@#### Generate URLs

@@bash @@djangowiz generate_urls <your_app> <your_project> <path/to/models.py> --overwrite @@

@@#### Generate Routes

@@bash @@djangowiz generate_routes <your_app> <your_project> <path/to/models.py> --overwrite @@

@@### Using Custom Templates

@@You can specify a custom template directory with the --template-dir option. If a custom template is not provided, the default templates will be used.

@@bash @@djangowiz generate_files <your_app> <your_project> <path/to/models.py> --overwrite --template-dir path/to/custom_templates @@

@@### Using Single File Mode

@@You can generate all serializers and viewsets in a single file using the --single-file option.

@@bash @@djangowiz generate_files <your_app> <your_project> <path/to/models.py> --overwrite --single-file @@

@@### Using as a Python Library

@@You can use DjangoWiz in your own Python scripts:

@@```python @@from djangowiz.core import ModelExtractor, ProjectGenerator

@@model_file = 'path/to/models.py' @@model_names = ModelExtractor.extract_model_names(model_file) @@generator = ProjectGenerator('your_app', 'your_project', model_names, template_dir='path/to/custom_templates') @@generator.generate_all(single_file=True, overwrite=True) @@```

@@## Directory Structure

@@Ensure your project directory is structured as follows:

@@ @@DjangoWiz/ @@├── djangowiz/ @@│ ├── __init__.py @@│ ├── core.py @@│ ├── cli.py @@│ ├── templates/ @@│ ├── docker-compose.dev.yml.j2 @@│ ├── docker-compose.prod.yml.j2 @@│ ├── Dockerfile.j2 @@│ ├── env.dev.j2 @@│ ├── env.prod.j2 @@│ ├── serializer.py.j2 @@│ ├── viewset.py.j2 @@│ ├── urls.py.j2 @@│ ├── routes.py.j2 @@├── pyproject.toml @@├── README.md @@├── LICENSE @@

@@## Customizing Templates

@@The templates used for generating files are located in the djangowiz/templates directory. You can customize these templates to fit your project's specific requirements. The templates use Jinja2 for rendering.

@@## License

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

@@## Contributing

@@Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.

@@## Author

@@Ali Tavallaie - a.tavallaie@gmail.com

@@---

@@Happy coding!

Metadata

Release files for djangowiz 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangowiz 0.2.1
File Size Uploaded Provenance
djangowiz-0.2.1.tar.gz 7.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for djangowiz 0.2.1
File Interpreter ABI Platform
djangowiz-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.7 kB

Release files / djangowiz-0.2.1.tar.gz

Download URL djangowiz-0.2.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9c67b3d8eb9b27e6f85f20e493f64776cd8c40c2ee7d631fa64f313919e35100
BLAKE2b-256 checksum
How to use checksums
acb299f6e4630726793eccb02e752b7c6d8de257f9595af11f1dfd3805cc8015
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.6 Linux/6.5.0-28-generic

Release files / djangowiz-0.2.1-py3-none-any.whl

Download URL djangowiz-0.2.1-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d505b6b82d0133c5b1af62e2afb020e6d970153a18805dcdb1196645b010ee54
BLAKE2b-256 checksum
How to use checksums
493dbc9026826af57bd3febfbd3ce96556658e89761d30f6cdde6b4e6be7f850
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.6 Linux/6.5.0-28-generic

Security for djangowiz 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page