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)
- Make a django project and create a new app as usual
pip install assisted-django
- On the same level as manage.py, create a python file (generate.py for example)
- Use the code below as a template, and replace the app_name, app_directory, and purpose variables with your own.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for assisted_django-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a3cf662881377f4085297a7294de2cd9ffc81b2d32ced2477c6ee4ff9236bc7 |
|
MD5 | 83c9a26036e886a1e8a6a5d9f9ccfc90 |
|
BLAKE2b-256 | 718216d55950b7ff4ebc742662ddacae294111f27a35c525b5d8ff550b27521d |