Skip to content

Latest commit

 

History

History

example

Example

Django AI Assistant examples. This is a Django project that integrates with Django AI Assistant library.

Most examples are inside a React frontend, but there is also a HTMX example.

Installation

Go to the example project, install its Node dependencies, and run the example Webpack devserver to build the React frontend:

# in example directory
cd example
pnpm install
pnpm run start

Install the example project Python dependencies:

cd ..  # back to project root directory
poetry install

Create a .env file at the example directory:

# in example directory
cp .env.example .env

Fill the .env file with the necessary API keys. You'll need accounts on:

Activate the poetry shell:

poetry shell

Run Django migrations:

# in example directory
python manage.py migrate

Create a superuser:

# in example directory
python manage.py createsuperuser

Run the Django server:

# in example directory
python manage.py runserver

[Optional] To use the RAG example, run:

# in example directory
python manage.py fetch_django_docs

Access the Django admin at http://localhost:8000/admin/ and log in with the superuser account.

Usage

Access the example project at http://localhost:8000/.

VSCode

Fix the Python path in your <project-root>/.vscode/settings.json to fix the Python import linting:

{
    // ...
    "python.analysis.extraPaths": [
        "example/"
    ]
}