
Build a django and python web app that connects to the OpenAI GPT API, manages questions and answers in a database with bootstrap UI, pagination, and delete options.
Download and install Python from python.org, choose the current version (3.11.1), and add Python to path so you can run it anywhere. Then proceed to install Django and other tools.
Install Sublime Text and the Git Bash terminal to run commands for the course, choosing default installation settings and downloading the latest versions on Windows.
Create and activate a virtual environment named virt for a Django chat project, using git bash on Windows, then prepare to install Django and OpenAI in isolation.
Install Django and the OpenAI library in your virtual environment, verify installations with pip freeze, and prepare to connect Django to Chat GPT for building a text completion bot.
Create a Django project named chat GPT and an app named chat bot, migrate the database, create a super user, and run the local server at 127.0.0.1:8000 to verify setup.
Learn to configure Django settings and routes by adding your chat bot app to installed apps, creating a dedicated urls.py, and wiring it into the project with include.
Create a Django home page by wiring a URL to a view that renders a home.html template, displaying 'Hello World' and preparing for bootstrap styling in the next step.
Learn to create a reusable base.html in a Django app, integrate Bootstrap 5.3 for styling, and use extends and block content to compose pages.
Add a bootstrap navbar by creating a separate nav bar HTML, including it in base.html, and customize its dark style, brand text, and home link using django URL tags.
Add a bootstrap card as the chat bot response box on the home page, customize its content, test display, and place the form beneath it for the next video.
Add a Bootstrap web form, customize fields and placeholders, and adjust button styles and input types for a clean, accessible interface, and prepare for back-end submission in the next video.
Post a web form to a Django backend, handle CSRF protection, capture user input as question, and display it on the home page while preparing for the OpenAI API integration.
Learn how to create an OpenAI account, verify identity, and generate an API key, then securely copy and plan to connect your Django app to the API.
Learn how to set up an OpenAI API key, import the OpenAI library, and craft a completion request using the text-davinci-003 model with temperature, max_tokens, top_p, and penalties.
Parse the OpenAI response by extracting choices[0].text, strip whitespace, and pass the result to the home page for display.
Learn to persist chat history in a Django app by tracking past_responses, rendering conditional forms, and passing responses to the backend for future database storage.
Create a Django model to save questions and answers with a CharField for questions and a TextField for answers, run migrations, and register it in admin to manage Q&A data.
Learn how to save questions and answers to the database by importing the model, creating a record, and calling save to persist data.
Create a Django page to display past questions and answers, wiring a URL, view, and template, naming the path past, and rendering a past HTML template for easy browsing.
Query the database in a Django view to fetch past questions and answers and render them on the web page using a loop in the template, preparing for delete feature.
Learn to implement item deletion in a Django app by wiring URLs and a delete view, selecting by primary key, performing delete, and redirecting with success messages and Bootstrap alerts.
Wrap API calls in a try block and catch exceptions to render the home page with the error, preventing the app from dying when timeouts, connectivity, or overload occur.
Learn to implement pagination for the past Q&A page using Django's paginator, set five items per page, read the page number from the query string, and create links.
Explore implementing pagination by exposing properties like has previous, current page, number of pages, has next, and next/previous page numbers to build navigation links.
Implement Bootstrap pagination for the question and answer section, adding previous, next, first, and last links with page query parameters, and refine the HTML and logic for active pages.
Learn to implement numeric pagination in Django by creating a pages counter, looping through page numbers in templates, and wiring first, previous, next, and last links for navigation.
Connect to the OpenAI ChatGPT API, query it, and pass the results into a Django web page from a view, illustrating a simple yet powerful text completion bot.
Unlock lifetime membership to over 60 coding courses, from Python and Django to JavaScript, with a $200 discount for three days; explore progress tracking, certificates, and community support.
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 Text Completion Artificial Intelligence API. You'll be surprised just how quickly you can create some pretty cool looking apps!
We'll use Python, Django, and the Bootstrap Framework to build a cool Chatbot app that connects to OpenAI.
You'll be able to type ChatGPT-like questions to straight from your app, and receive an OpenAI response that is output to the screen of your app.
We'll also use a database to save all of the questions and answers that you've typed into your app, and we'll query that database and output the answers on their own web page. We'll add stylish Pagination to the page as well so that you can page through the responses.
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.