Skip to main content

Django Make App: generate Django app from YAML

PyPi MIT TravisCI Coverage Requirements Status

Introduction

Django-make-app will generate code of your Django app from a simple YAML schema. This is similar to manage.py startapp but much powerful.

This will be generated from models definitions:

  • Admin classes and admin forms

  • Django REST framework View Sets, Serializers and Router configuration

  • Django AppConfig

  • Django System Checks

  • Forms classes

  • Models classes

  • Detail/Delete/Update/Create/List views, urls and templates

  • Management command example

  • Dummy filter

  • Signals and receivers files

  • TODO tests

Installation

Supported Python versions are: 2.7, 3.4, 3.5, 3.6, pypy and pypy3.

pip install --upgrade django-make-app

Python 3.3 is not supported due to incompatibility of yapf (see: https://github.com/google/yapf#python-versions). If you’re on Python 3.3, you can use this package with option django-make-app generate ... --no-optimize (this will skip yapf).

Usage

If you want to generate app called library, create a file app_schema.yaml in project’s root and define models:

apps:
    -
        name: library           # all files will be generated into library/ directory (will be created)
        models:
          - User:               # model name
            - name:char         # model field "name" of type "char"
            - email:char        # model field "email" of type "char"
          - Book:               # another model
            - library:fk        # model field "library" of type "foreign key" to "library"
          - Article             # empty model without fields
    -
        name: my_another_awesome_app
        models:
            - City
            - Country

You can also print example configuration by executing (or check templates/example.yaml):

django-make-app write_config > app_schema.yaml

Finally to generate source code of your app, execute:

django-make-app generate library

This structure will be generated:

LIBRARY
|   admin.py
|   api.py
|   apps.py
|   checks.py
|   forms.py
|   models.py
|   receivers.py
|   serializers.py
|   signals.py
|   urls.py
|   views.py
|   __init__.py
|
|---management
|   |   __init__.py
|   |
|   \---commands
|           library_command.py
|           __init__.py
|
|---migrations
|       __init__.py
|
|---templates
|   \---web
|           book_delete.html
|           book_detail.html
|           book_form.html
|           book_list.html
|           article_delete.html
|           article_detail.html
|           article_form.html
|           article_list.html
|           user_delete.html
|           user_detail.html
|           user_form.html
|           user_list.html
|
|---templatetags
|       web_tags.py
|       __init__.py
|
\---tests
        factories.py
        test_book.py
        test_article.py
        test_user.py
        __init__.py

Inspiration

License

The MIT License (MIT)

Copyright (c) 2016–2017 Vašek Dohnal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for django_make_app 0.1.3

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

Source distribution (sdist)

Source distribution for django_make_app 0.1.3
File Size Uploaded Provenance
django_make_app-0.1.3.tar.gz 15.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django_make_app 0.1.3
File Interpreter ABI Platform
django_make_app-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 42.6 kB

Release files / django_make_app-0.1.3.tar.gz

Download URL django_make_app-0.1.3.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a5234800405999927141b2fd279c8d0c33d169727ce9850e7daa83f2eb6d7f16
BLAKE2b-256 checksum
How to use checksums
7acd30ae7a1ecf73301c5b3781d0d4e14f6c9415d9e3e97c8f522b636d59bad9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_make_app-0.1.3-py2.py3-none-any.whl

Download URL django_make_app-0.1.3-py2.py3-none-any.whl
Size 26.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6ffe51a816d96032761785d7331a4f1df1dfc8b3a442c72cfeb6bda657dbf51f
BLAKE2b-256 checksum
How to use checksums
e7557d567d8f10fe8f9af4edb0c1a01499d5b6b892767eae500ae71fa669d711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django_make_app 0.1.3

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