Skip to main content

Generate an entire django app with models, forms, views, urls, signals, tests and templates using gpt3 or 4

Project description

Assisted Django

Assisted Django is a python package that uses OpenAI's gpt-3 / 4 to generate Django code based on a project brief.

This script would generate the following files for you:

  • models.py
  • views.py
  • urls.py
  • admin.py
  • tests.py
  • forms.py
  • signals.py
  • HTML templates

You can also let the script generate the detailed project brief by passing better_brief=True to the generate method.

This script is not meant to replace the startapp command, but meant to be run after the startapp command has generated the basic files. However, you do not need to create the additional files (such as forms.py, signals.py, tests.py, urls.py etc) as this script will create them for you.

Example Video

https://github.com/fauzaanu/assisted-django/assets/86226565/6c5d9b8a-68c8-4883-a65d-c08c41fbb913

Example of how to run this: (Video is outdated, and before template generation was added)
  1. Make a django project and create a new app as usual
  2. pip install assisted-django
  3. On the same level as manage.py, create a python file (generate.py for example)
  4. Use the code below as a template, and replace the app_name, app_directory, and purpose variables with your own.
  5. before running set the OPENAI_API_KEY environment variable to your openai api key
from assisted_django.DjangoApplication import DjangoApplication


def enhance_django_app():
    app_name = "fakebook_clone"  # replace with your actual Django app name (NOT PROJECT NAME)
    app_directory = "Basic/fakebook_clone"  # replace with your actual Django app directory (ProjectDir/Appdir)

    with open("../fakebook_clone", "r") as f:  # Replace with your actual Project Brief
        purpose = f.read()

    django_app = DjangoApplication(app_name, purpose, app_directory)
    django_app.generate(better_brief=True) # better_brief=True would generate a better brief first


if __name__ == '__main__':
    enhance_django_app()

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

assisted_django-0.1.7.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

assisted_django-0.1.7-py3-none-any.whl (9.5 kB view hashes)

Uploaded Python 3

Supported by

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