Skip to content

example of small django project with a few models, REST endpoints and background task scheduler

Notifications You must be signed in to change notification settings

PetrSebik/applifting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Applifting example project

Description

This project is a small example Django application that demonstrates how to create a REST API with a few models.

Installation

  1. Clone this repository
  2. Install poetry using pip pip install poetry
  3. cd into the project folder
  4. Install dependencies using the poetry poetry install
  5. Setup local postgres database and edit the .env file with your connection values
  6. Run the tests using python manage.py test
  7. Run the database migrations using python manage.py migrate
  8. Run the scheduler migration using python manage.py qmigrate

Usage

  1. Start the background scheduler using python manage.py cluster
  2. Start the development server using python manage.py runserver.
  3. Navigate to http://localhost:8000/schema/ to view the API Swagger.

Endpoints

Product

  • id - uuid type, autogenerated
  • name - string type, max length 64
  • description - string type, max length 256

POST /api/products/

  • Create a new product

GET /api/products/

  • Get a list of products

GET /api/products/<:uuid>/

  • Get a specific product

PUT /api/products/<:uuid>/

  • Update all data of the product

PATCH /api/products/<:uuid>/

  • Update any field of the product

DELETE /api/products/<:uuid>/

  • Delete a specific product

Offer

  • id - uuid type, autogenerated
  • price - int type
  • item_in_stock - int type

POST /api/offers/

  • get a list of products and list of offers for each product

APIToken

internal model for communicating with external API

  • token - string type, max length 256
  • exp - datetime type

About

example of small django project with a few models, REST endpoints and background task scheduler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages