
Create an ai code generator and code fixer site with django and python using the OpenAI API to generate and fix code, with user login and per-user saved snippets.
Download and install Python from python.org, ensure the add Python to path option is checked, and reinstall if needed before proceeding to the text editor and terminal setup.
Install Sublime Text and the Git Bash terminal to write code and run commands for this course, setting up before Django.
Set up a project directory, create and activate a Python virtual environment, then install Django and OpenAI to build a code writing ChatGPT AI site.
Create a Django project named code bot and an app called website, run migrations, and launch the local server to verify setup.
Set up version control for your Django Python project by generating an SSH key and adding it to GitHub for secure offsite code backups.
Set up version control with Git and GitHub for your Django project, initialize a repository, make the initial commit, rename master to main, and push code to GitHub.
Configure the Django project by updating settings and urls, add the website app to installed apps, create website.urls, and include it in the project urls for a working home page.
Create a Django home page by wiring a URL, a view, and a home.html template, render the page with the request, and display hello world.
Create a reusable Django base template with bootstrap styling, using a base.html and a content block to propagate changes across all pages via extends.
Set up a Bootstrap nav bar for a Django site by copying an example, saving it as nav bar HTML, and including it in base.html, then switch to dark theme.
Choose prism.js to style code blocks, set a dark theme, enable line numbers and copy-to-clipboard, and configure languages and plugins for seamless integration.
Download and install Prism into your Django app by creating static/css and static/js, download the minified Prism with tomorrow night and languages, and enable auto loader and copy to clipboard.
Load static files in a Django page with the load static tag, link prism.css from the CSS static directory, and include prism.js from the JS static directory.
Apply Prism syntax highlighting to your homepage by using code and pre tags, labeling code blocks with language-python, and enabling line numbers and copy functionality.
This lecture guides adding a django form under the code box using bootstrap form-control, including a post form with csrf token, a textarea named code, and a language select.
Build a dynamic select menu by sorting a Python language list and passing it to the page, then loop to render each language as an option.
Handle form submissions in Django by checking request.method for post and pulling code and language from request.POST, then post them back to the page for display.
Validate a selected programming language in a Django app, flash a Bootstrap alert if none is chosen, and preserve the entered code on reload.
OpenAI introduction guides you to sign up, secure a secret key, and use the text completion API with the Da Vinci model, while noting pricing and token credits.
Design and implement an api request workflow using openai to fix code, with a home page posting language-specific prompts, handling errors, and returning code-only responses from the text-davinci-003 model.
Parse the API response by extracting the first choice's text, strip line breaks, and test the snippet in Python to display the parsed output.
Create a code suggestion page in a Django Python app by configuring the suggest url, its view, and template, and linking it in the navbar.
Create a Django Python code writing site feature by duplicating the home logic, refining the suggest function to respond only with code, and testing with C-sharp and Python.
Set up basic Django user authentication, enabling sign up, login, and logout, with URL routes and a sign up form to store each user's code in the database.
Learn to implement login and logout views in Django by handling post requests, authenticating users, logging them in or out, displaying messages, and redirecting to the home page.
Define the register user view to handle post requests, validate and save the sign up form, authenticate and log in the user, and render the register.html page when not posting.
Create a Django signup form by extending user creation form, wiring in the Django user model, and collecting username, email, first name, last name, and password twice with Bootstrap styling.
Create a register page for Django, using a bootstrap form with a csrf token, display of form errors, and posting to the register view via a Django URL tag.
Create a navigation bar that shows log out or log in and register based on user authentication, and add a login form tied to the login view to reflect user.is_authenticated.
Learn to fix login errors by creating a Django super user, logging into the admin, and testing login flows, including case sensitivity issues and updating login pages.
Create a Django code model linked to users, storing the question, AI code answer, and language; then create and run migrations to save responses.
import the code model and save a record with the question, code answer, language, and user. save the record to the database and prepare to display it on the site.
Create a past code page in a Django Python app by adding a URL, view, and template, showing authenticated users' questions, code, and language.
Learn how to delete code items in a Django app by wiring a delete past url and view, retrieving by primary key, and redirecting with a success message.
Finish a code writing ai site with Django Python, saving code to the database and displaying it per user page; admin and John can view pass codes through simple querying.
Explore Django and Python-based projects and access a vast library of coding courses with a lifetime membership. Enjoy a three-day, $200 discount on all courses, PDFs, and future content.
In this course I'll teach you how to make web apps for Django and Python, and how to connect those apps to the OpenAI (makers of ChatGPT) Text Completion Artificial Intelligence API and have it fix code that you submit as well as write code that you ask it to write.
We'll use Python, Django, and the Bootstrap Framework to build a cool Coding website that connects to OpenAI.
You'll be able to:
Submit your Code and have the A.I. suggest fixes
Ask The A.I. To write code for you.
Choose from over a dozen programming languages
Save your code responses to the Database
View Past Code Responses from the Database
We'll use a database to save all of the code answers that you've received from the OpenAI API, and we'll query that database and output the answers on their own web page.
Finally, I'll discuss how to connect to OpenAI with an API Key, query the engine, and parse the responses in the correct way and output the answers to the homepage of your Django app.
If you've seen ChatGPT recently and want to learn how to use these tools programmatically, then this is the course for you!
We'll use the Bootstrap CSS Framework to make our Django web app look a little more modern and professional. This will allow us to make our site look great, very quickly and easily-- without knowing much about design.