-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from vintasoftware/fix/readme
Dedicated README for example and fix package.json for npm link
- Loading branch information
Showing
5 changed files
with
109 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# 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 project root, then frontend dir and build the frontend library: | ||
|
||
```bash | ||
cd .. # back to project root directory | ||
cd frontend | ||
npm install | ||
npm run build | ||
``` | ||
|
||
Then use `npm link` to link the frontend library to the example project: | ||
|
||
```bash | ||
cd frontend | ||
npm link | ||
``` | ||
|
||
Go to the example project to finish the link with the frontend library: | ||
|
||
```bash | ||
cd .. # back to project root directory | ||
cd example | ||
npm link django-ai-assistant-client | ||
``` | ||
|
||
Run the example Webpack devserver to build the React frontend: | ||
|
||
```bash | ||
# in example directory | ||
npm install | ||
npm run start | ||
``` | ||
|
||
Install the example project Python dependencies: | ||
|
||
```bash | ||
cd .. # back to project root directory | ||
poetry install | ||
``` | ||
|
||
Create a `.env` file at the example directory: | ||
|
||
```bash | ||
# in example directory | ||
cp .env.example .env | ||
``` | ||
|
||
Fill the `.env` file with the necessary API keys. You'll need accounts on: | ||
|
||
- [OpenAI](https://platform.openai.com/) | ||
- [Weather](https://www.weatherapi.com/) | ||
- [Tavily](https://app.tavily.com/) | ||
- [Firecrawl](https://www.firecrawl.dev/) | ||
|
||
Run Django migrations: | ||
|
||
```bash | ||
# in example directory | ||
python manage.py migrate | ||
``` | ||
|
||
Create a superuser: | ||
|
||
```bash | ||
# in example directory | ||
python manage.py createsuperuser | ||
``` | ||
|
||
Run the Django server: | ||
|
||
```bash | ||
# in example directory | ||
python manage.py runserver | ||
``` | ||
|
||
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/`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters