Skip to content

This project is a Django Project Generator that allows users to create multiple-page Django websites quickly. It uses GPT-3.5 content for each page and update existing templates.

Notifications You must be signed in to change notification settings

redcartel243/GPT_DjangoProjectGenerator

Repository files navigation

Django Project Generator

This project is a command-line tool for generating and updating Django projects. It uses GPT-3.5 to create HTML templates based on user descriptions, automates project creation, and supports custom templates, CSS, and JavaScript files. Additionally, it handles user authentication.

Features

  • Create multiple-page Django websites
  • Optional predefined or custom templates, CSS, and JavaScript files
  • Generate Django models and forms based on user input
  • Authentication features (registration, login, and logout)
  • GPT-3.5 generated HTML content for each page
  • Update existing HTML templates using GPT-3.5

Prerequisites

  • Python 3.8 or later
  • Django 3.2 or later
  • OpenAI Python Library

Setup

  1. Install the required packages using pip:

pip install -r requirements.txt

  1. Set your OpenAI API key as an environment variable or update the openai.api_key value in gpt.py.
  2. Run the Django project generator:

python main.py create <project_name> <app_name> <num_pages> --template <template_name> --custom_template_path <custom_template_path> --custom_css_path <custom_css_path> --custom_js_path <custom_js_path> --models <model_descriptions>

  • <project_name>: Name of the Django project
  • <app_name>: Name of the Django app
  • <num_pages>: Number of pages to create
  • <template_name>: (Optional) Predefined template to use (template1 or template2)
  • <custom_template_path>: (Optional) Path to the custom HTML template
  • <custom_css_path>: (Optional) Path to the custom CSS file
  • <custom_js_path>: (Optional) Path to the custom JavaScript file
  • <model_descriptions>: (Optional) List of model descriptions
  1. Update an existing Django project:

python main.py update <html_template_path> <description>

  • <html_template_path>: Path to the HTML template to update
  • <description>: Description of the changes to make to the existing HTML template

Project Structure

The project is organized into the following modules:

  1. main.py: Entry point of the application
  2. gpt.py: GPT-3.5 functions for generating content and updating templates
  3. project_creation.py: Functions for creating and updating Django projects and apps
  4. static_files.py: Functions for handling static files (CSS and JavaScript)
  5. authentication.py: Functions for generating user authentication views, templates, and URLs

Refer to the source code for detailed information on each module's functionality.

Notes

  • This project uses GPT-3.5, which requires an API key from OpenAI. Make sure to set your OpenAI API key in the gpt.py file.
  • The GPT-3.5 model has a token limit. If the generated content exceeds this limit, the output might be incomplete. Adjust the max_response_tokens and total_tokens variables in gpt.py as needed.

About

This project is a Django Project Generator that allows users to create multiple-page Django websites quickly. It uses GPT-3.5 content for each page and update existing templates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages