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
Comprehensive Markdown plugin built for Django

Django MarkdownX Django MarkdownX is a comprehensive Markdown plugin built for Django, the renowned high-level Python web framework, with flexibility,

neutronX 738 Dec 21, 2022
A BitField extension for Django Models

django-bitfield Provides a BitField like class (using a BigIntegerField) for your Django models. (If you're upgrading from a version before 1.2 the AP

DISQUS 361 Dec 22, 2022
Application made in Django to generate random passwords as based on certain criteria .

PASSWORD GENERATOR Welcome to Password Generator About The App Password Generator is an Open Source project brought to you by Iot Lab,KIIT and it brin

IoT Lab KIIT 3 Oct 21, 2021
A helper for organizing Django project settings by relying on well established programming patterns.

django-configurations django-configurations eases Django project configuration by relying on the composability of Python classes. It extends the notio

Jazzband 953 Dec 29, 2022
Django Livre Bank

Django Livre Bank Projeto final da academia Construdelas. API de um banco fictício com clientes, contas e transações. Integrantes da equipe Bárbara Sa

Cecília Costa 3 Dec 22, 2021
Median and percentile for Django and MongoEngine

Tailslide Median and percentile for Django and MongoEngine Supports: PostgreSQL SQLite MariaDB MySQL (with an extension) SQL Server MongoDB 🔥 Uses na

Andrew Kane 4 Jan 15, 2022
Django With VueJS Blog App

django-blog-vue-app frontend Project setup yarn install Compiles and hot-reload

Flavien HUGS 2 Feb 04, 2022
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
Django CRUD REST API Generator

Django CRUD REST API Generator This is a simple tool that generates a Django REST API with the given models. Specs: Authentication, DRF generic views,

Mehmet Alp Sümer 57 Nov 24, 2022
Django-discord-bot - Framework for creating Discord bots using Django

django-discord-bot Framework for creating Discord bots using Django Uses ASGI fo

Jamie Bliss 1 Mar 04, 2022
Resolve form field arguments dynamically when a form is instantiated

django-forms-dynamic Resolve form field arguments dynamically when a form is instantiated, not when it's declared. Tested against Django 2.2, 3.2 and

DabApps 108 Jan 03, 2023
Django React Project Setup

Django-React-Project-Setup INSTALLATION: python -m pip install drps USAGE: in your cmd: python -m drps Starting fullstack project with Django and Reac

Ghazi Zabalawi 7 Feb 06, 2022
Custom Django field for using enumerations of named constants

django-enumfield Provides an enumeration Django model field (using IntegerField) with reusable enums and transition validation. Installation Currently

5 Monkeys 195 Dec 20, 2022
Extensions for using Rich with Django.

django-rich Extensions for using Rich with Django. Requirements Python 3.6 to 3.10 supported. Django 2.2 to 4.0 supported. Are your tests slow? Check

Adam Johnson 88 Dec 26, 2022
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

2.2k Jan 02, 2023
Django's class-based generic views are awesome, let's have more of them.

Django Extra Views - The missing class-based generic views for Django Django-extra-views is a Django package which introduces additional class-based v

Andy Ingram 1.3k Jan 04, 2023
Add Chart.js visualizations to your Django admin using a mixin class

django-admincharts Add Chart.js visualizations to your Django admin using a mixin class. Example from django.contrib import admin from .models import

Dropseed 22 Nov 22, 2022
This a Django TODO app project and practiced how to deploy and publish the project to Heroku

ToDo App Demo | Project Table of Contents Overview Built With Features How to use Acknowledgements Contact Overview Built With HTML CSS JS Django How

Cetin OGUT 1 Nov 19, 2021
Backend with Django .

BackendCode - Cookies Documentation: https://docs.djangoproject.com/fr/3.2/intro/ By @tcotidiane33 & @yaya Models Premium class Pack(models.Model): n

just to do it 1 Jan 28, 2022
Easily share data across your company via SQL queries. From Grove Collab.

SQL Explorer SQL Explorer aims to make the flow of data between people fast, simple, and confusion-free. It is a Django-based application that you can

Grove Collaborative 2.1k Dec 30, 2022