Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example PostgresML application using Django

License

NotificationsYou must be signed in to change notification settings

postgresml/example-django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup

This example application requires a PostgreSQL database with the PostgresML and pgvector extensions installed. The easiest way to get one is to sign upfor a free database onpostgresml.org.

We're usingcurl to make requests to the app, so if you don't have it already install bothcurl andjq.

Virtualenv

It's recommended to use a virtual environment to run this example. You can create one using the following commands:

python3 -m venv venvsource venv/bin/activatepip install -r requirements.txt

SettingDATABASE_URL

In your shell, export theDATABASE_URL variable with the connection string to your database. For example:

export DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/postgres

Running the app

./manage.py migrate./manage.py runserver

Usage

Adding a TODO item

Using cURL, make a POST request to/api/todo/ with the two required fields, description & due date:

curl \    --silent \    -X POST \    -d'{"description": "Make a New Year resolution list", "due_date": "2025-01-01"}' \    -H'Content-Type: application/json' \    http://localhost:8000/api/todo/

Searching for similar items

curl \    --silent \    -H"Content-Type: application/json" \'http://localhost:8000/api/todo/search/?q=resolution&limit=1'| jq".[0].description"

About

Example PostgresML application using Django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp