An API was build with Django to store and retrieve information about various musical instruments.

Overview

Practise Django REST Framework API- 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 methodologies.

Methodologies used:

  • MVC(Model-View-Controller) pattern
  • Data transfer Objects (DTOs)
  • Object relational mapper (ORM)
  • API building conventions from OpenAPI specfifications
  • Dependency injection
  • Class based views and ViewSets routing

Tools used:

  • Django
  • MySQL
  • Django REST framework
  • Docker
  • Docker Compose (for orchestration)
  • Injector

Installation and deployment

The API can be run in two ways:

  • As a Docker container
  • As a standalone API service on the localhost

Run service with Docker

To run it in a Docker container simple git-clone the repo and cd to the directory where the docker-compose.yml file is located.

Execute docker-compose up in this directory. Two containers should start, one that hosts the MySQL server for our database and one which hosts the actual django application.

The application will try to connect to the database. If the database that is trying to connect does not exist, it has to be first created in MySQL. This can be done either by the terminal inside the container or through the MySQL workbench. Some information can be found here: Create a database in a Docker container for local development. The default database details set in this project can be seen in the snippet below.

If the database was already created, the service will connect to it automatically.

Run service in localhost

For easier testing and debugging the application can be run in the localhost by moving to the directory where the manage.py file is and execute the command: python manage.py runserver 0.0.0.0:8080

A MySQL server must exist in the localhost and a database should also exist in MySQL that matches the database details found in the core/settings.py. The default details that were set in the project can be seen below.

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.mysql",
        "NAME": "instruments_db",
        "USER": "instruments_admin",
        "PASSWORD": "instruments",
        "HOST": "db",
        "PORT": "3306",
    }
}
You might also like...
Store events and publish to Kafka

Create an event from Django ORM object model, store the event into the database and also publish it into Kafka cluster.

Yummy Django API, it's the exclusive API used for the e-yummy-ke vue web app

Yummy Django API, it's the exclusive API used for the e-yummy-ke vue web app

Django project starter on steroids: quickly create a Django app AND generate source code for data models + REST/GraphQL APIs (the generated code is auto-linted and has 100% test coverage).

Create Django App 💛 We're a Django project starter on steroids! One-line command to create a Django app with all the dependencies auto-installed AND

A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, celery and redis.

Django Channels Websocket Chatbot A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, c

Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Meta package to combine turbo-django and stimulus-django

Hotwire + Django This repository aims to help you integrate Hotwire with Django 🚀 Inspiration might be taken from @hotwired/hotwire-rails. We are sti

django-quill-editor makes Quill.js easy to use on Django Forms and admin sites
django-quill-editor makes Quill.js easy to use on Django Forms and admin sites

django-quill-editor django-quill-editor makes Quill.js easy to use on Django Forms and admin sites No configuration required for static files! The ent

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

Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot. A fully Django starter project.

Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot 🚀 Features A Django stater project with fully basic requirements for a production-ready

Owner
Kostas Ziovas
Engineer turned software developer. Particularly interested in Python, C#, back-end development, software engineering, ML and AI
Kostas Ziovas
This website serves as an online database (hosted via SQLLite) for fictional businesses in the area to store contact information (name, email, phone number, etc.) for fictional customers.

Django-Online-Business-Database-Project this project is still in progress Overview of Website This website serves as an online database (hosted via SQ

null 1 Oct 30, 2021
Django URL Shortener is a Django app to to include URL Shortening feature in your Django Project

Django URL Shortener Django URL Shortener is a Django app to to include URL Shortening feature in your Django Project Install this package to your Dja

Rishav Sinha 4 Nov 18, 2021
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 API without Django REST framework.

Django API without DRF This is a API project made with Django, and without Django REST framework. This project was done with: Python 3.9.8 Django 3.2.

Regis Santos 3 Jan 19, 2022
Django-gmailapi-json-backend - Email backend for Django which sends email via the Gmail API through a JSON credential

django-gmailapi-json-backend Email backend for Django which sends email via the

Innove 1 Sep 9, 2022
Build reusable components in Django without writing a single line of Python.

Build reusable components in Django without writing a single line of Python. {% #quote %} {% quote_photo src="/project-hail-mary.jpg" %} {% #quot

Mitchel Cabuloy 277 Jan 2, 2023
Forgot password functionality build in Python / Django Rest Framework

Password Recover Recover password functionality with e-mail sender usign Django Email Backend How to start project. Create a folder in your machine Cr

alexandre Lopes 1 Nov 3, 2021
A modern looking portfolio build with Django.

Django Portfolio A portfolio template using html/css/js in the frontend and Django as the backend framework. Cool features: smooth scrolling responsiv

null 1 Jan 19, 2022
Store model history and view/revert changes from admin site.

django-simple-history django-simple-history stores Django model state on every create/update/delete. This app supports the following combinations of D

Jazzband 1.8k Jan 8, 2023
Store model history and view/revert changes from admin site.

django-simple-history django-simple-history stores Django model state on every create/update/delete. This app supports the following combinations of D

Jazzband 1.8k Jan 6, 2023