Simple API written in Python using FastAPI to store and retrieve Books and Authors.

Related tags

Djangobook-pyapi
Overview

Simple API made with Python FastAPI

WIP: Deploy in AWS with Terraform

Simple API written in Python using FastAPI to store and retrieve Books and Authors.

Requisites

This app is intended to run at minimun Python version 3.6. Extra requirements can be seen in requirements.txt file.

Database Customization

It is possible to customize the application to use SQLite or MySQL.

By default, the application uses SQLite and stores the database in the root folder.

To customize the PATH for the SQLite database set the environment variable DB_PATH to the absolute path of the database file.

Environment Variables usages as following:

ENV Default Value Description
DB_TYPE sqlite Database type, valid values are sqlite and mysql.
DB_PATH ./database.db Database absolute path for sqlite database only.
DB_HOST 127.0.0.1 Database host address for mysql database only.
DB_PORT 3306 Database port for mysql database only.
DB_NAME books Database name for mysql database only.
DB_USER user Database user for connecting to mysql database only.
DB_PASS password Database password for connecting to mysql database only.

Application

The default webpage is the swagger-ui running at the root path of the webserver (/). You can also access the redoc-ui at the docs path of the webserver (/docs)

Deployment

Local

To deploy it locally its suggested to set up a venv.

Clone the repository:

$ git clone [email protected]:caiodelgadonew/book-pyapi.git

Create a Virtual Environment and source it:

$ python3 -m venv book-pyapi
$ source book-pyapi/bin/activate

After initializing your Virtual Environment install all dependencies

$ pip3 install -r app/requirements.txt

Execute uvicorn

$ uvicorn books.main:app --reload

Access http://127.0.0.1:8000 at your browser.

Docker Container - SQLite

To run the application as a Docker Container you can use the provided docker-compose-sqlite.yml

Be sure to have docker and docker-compose installed before proceeding

Clone the repository:

$ git clone [email protected]:caiodelgadonew/book-pyapi.git

Run docker-compose up to create the environment:

$ docker-compose -f book-pyapi/docker-compose-sqlite.yml up

You can add -d to the docker-compose command to start detached

The database will be automatically populated through the API with two users and some books, if you dont want to populate the database comment the block database-init from docker-compose-sqlite.yml.

After the application healthcheck (30s) the database-init container will start and populate the database with some data.

Access the application at the address: http:// :9000

Docker Container - MySQL

To run the application as a Docker Container you can use the provided docker-compose.yml

Be sure to have docker and docker-compose installed before proceeding

Clone the repository:

$ git clone [email protected]:caiodelgadonew/book-pyapi.git

Run docker-compose up to create the environment:

$ docker-compose  up

You can add -d to the docker-compose command to start detached

The database will be automatically populated through the API with two users and some books, if you dont want to populate the database comment the block database-init from docker-compose.yml.

After the application healthcheck (30s) the database-init container will start and populate the database with some data.

Access the application at the address: http:// :9000

[WIP] Deploy in AWS with Terraform

You might also like...
APIs for a Chat app. Written with Django Rest framework and Django channels.
APIs for a Chat app. Written with Django Rest framework and Django channels.

ChatAPI APIs for a Chat app. Written with Django Rest framework and Django channels. The documentation for the http end points can be found here This

A small and lightweight imageboard written with Django

Yuu A small and lightweight imageboard written with Django. What are the requirements? Python 3.7.x PostgreSQL 14.x Redis 5.x FFmpeg 4.x Why? I don't

Hello world written in Django.

Learning Django 💡 create a virtual environment create python -m venv ./venv. this virtualenv file will be excluded by .gitignore activate the virtual

Advanced school management system written in Django :)
Advanced school management system written in Django :)

Advanced school management system written in Django :) ⚙️ Config the project First you should make venv for this project. So in the main root of proje

PicoStyle - Advance market place website written in django
PicoStyle - Advance market place website written in django

Advance market place website written in django :) Online fashion store for whole

A clone of https://virgool.io written in django

Virgool clone A clone of virgool blog written in django Installation first rename the .env.sample to .env and fill it. with docker docker-compose up -

A simple Blog Using Django Framework and Used IBM Cloud Services for Text Analysis and Text to Speech

ElhamBlog Cloud Computing Course first assignment. A simple Blog Using Django Framework and Used IBM Cloud Services for Text Analysis and Text to Spee

A simple trivia quizzz web app made using django

Trivia Quizzz A simple trivia quizzz web app made using django Demo http://triviaquizzz.herokuapp.com/ & https://triviaquiz.redcrypt.xyz Features Goog

Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.
Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

Releases(v1.0.0)
Owner
Caio Delgado
I am no Jedi
Caio Delgado
The new Python SDK for Sentry.io

Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoy

Sentry 1.4k Jan 05, 2023
Django-Docker - Django Installation Guide on Docker

Guía de instalación del Framework Django en Docker Introducción: Con esta guía p

Victor manuel torres 3 Dec 02, 2022
Full control of form rendering in the templates.

django-floppyforms Full control of form rendering in the templates. Authors: Gregor Müllegger and many many contributors Original creator: Bruno Renié

Jazzband 811 Dec 01, 2022
Automated image processing for Django. Currently v4.0

ImageKit is a Django app for processing images. Need a thumbnail? A black-and-white version of a user-uploaded image? ImageKit will make them for you.

Matthew Dapena-Tretter 2.1k Jan 04, 2023
This is a basic Todo Application API using Django Rest Framework

Todo Application This is a basic Todo Application API using Django Rest Framework. Todo Section - User can View his previously added todo items, creat

Atharva Parkhe 1 Aug 09, 2022
A Django app to accept payments from various payment processors via Pluggable backends.

Django-Merchant Django-Merchant is a django application that enables you to use multiple payment processors from a single API. Gateways Following gate

Agiliq 997 Dec 24, 2022
Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav & ogg), which also makes it easy to play audio files into your Django application.

Django-Audiofield Description: Django Audio Management Tools Maintainer: Areski Contributors: list of contributors Django-Audiofield is a simple app t

Areski Belaid 167 Nov 10, 2022
Simple application TodoList django with ReactJS

Django & React Django We basically follow the Django REST framework quickstart guide here. Create backend folder with a virtual Python environment: mk

Flavien HUGS 2 Aug 07, 2022
An API was build with Django to store and retrieve information about various musical instruments.

The project is meant to be a starting point, an experimentation or a basic example of a way to develop an API with Django. It is an exercise on using Django and various python technologies and design

Kostas Ziovas 2 Dec 25, 2021
This is a repository for a web application developed with Django, built with Crowdbotics

assignment_32558 This is a repository for a web application developed with Django, built with Crowdbotics Table of Contents Project Structure Features

Crowdbotics 1 Dec 29, 2021
PEP-484 type hints bindings for the Django web framework

mypy-django Type stubs to use the mypy static type-checker with your Django projects This project includes the PEP-484 compatible "type stubs" for Dja

Machinalis 223 Jun 17, 2022
Django GUID attaches a unique correlation ID/request ID to all your log outputs for every request.

Django GUID Now with ASGI support! Django GUID attaches a unique correlation ID/request ID to all your log outputs for every request. In other words,

snok 300 Dec 29, 2022
Template for Django Project Using Docker

You want a Django project who use Docker and Docker-compose for Development and for Production ? It's for you !

1 Dec 17, 2021
Opinionated boilerplate for starting a Django project together with React front-end library and TailwindCSS CSS framework.

Opinionated boilerplate for starting a Django project together with React front-end library and TailwindCSS CSS framework.

João Vítor Carli 10 Jan 08, 2023
A simple demonstration of integrating a sentiment analysis tool in a django project

sentiment-analysis A simple demonstration of integrating a sentiment analysis tool in a django project (watch the video .mp4) To run this project : pi

2 Oct 16, 2021
A beginner django project and also my first Django project which involves shortening of a longer URL into a short one using a unique id.

Django-URL-Shortener A beginner django project and also my first Django project which involves shortening of a longer URL into a short one using a uni

Rohini Rao 3 Aug 08, 2021
Basic implementation of Razorpay payment gateway 💳 with Django

Razorpay Payment Integration in Django 💥 In this project Razorpay payment gateway 💳 is integrated with Django by breaking down the whole process int

ScaleReal 12 Dec 12, 2022
An airlines clone website with django

abc_airlines is a clone website of an airlines system the way it works is that first you add flights to the website then the users can search flights

milad 1 Nov 16, 2021
Use Database URLs in your Django Application.

DJ-Database-URL This simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django appl

Jacob Kaplan-Moss 1.3k Dec 30, 2022
Sistema administrador de contranas desarrollador en Django

Sistema Contrasenas Desarrolado en Django Proyecto sistema de administracion de contraseñas, de la experiencia educativa Programacion Segura Descripci

Ibrain Rodriguez Espinoza 1 Sep 24, 2022