Developers are always looking around to integrate solutions in existing projects rather than creating a separate app or project for analytics and visualizations. Dash and Plotly provides a huge support to integrate graphs and create an interactive dashboard for your existing project.

Prerequisites

  • Docker
  • Plotly
  • Redis
  • Dash
#requirements.txtDjango==3.0.5
pandas
requests
django-plotly-dash==1.5.0
django-redis==4.10.0
dpd-components==0.1.0
redis==3.3.11
plotly==4.14.3
channels==2.3.0
channels-redis==2.4.0
daphne==2.3.0
dash==1.19.0
aioredis==1.3.0
asgiref==3.2.2
async-timeout==3.0.1
attrs==19.3.0
autobahn==19.10.1
Automat==0.7.0
cffi==1.13.0
dash-bootstrap-components==0.11.1…


Django-Rest-Framework has inbuilt support for UI to execute API’s but DRF YASG is included with swagger io for API’s. The schema is needed to make API user readable and executable.

Link to download the library :- https://pypi.org/project/drf-yasg/

Requirements: Django project setup with Django Rest API’s.

from drf_yasg.utils import swagger_auto_schema
from drf_yasg import openapi
@swagger_auto_schema(methods=['POST'], request_body=openapi.Schema()
def methodname(request):
#code

2. Setup urls.py

from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="API V1",
default_version='v1',
description="This is V1 API's",
terms_of_service="https://www.google.com/policies/terms/",
contact=openapi.Contact(email="demo@gmail.com"),
license=openapi.License(name="Test License"),
)
public=True,
permission_classes=(permissions.AllowAny)
)
urlpatterns = [path('get_all_data/',api_get_all_data,name="all_data"),]

3. Setup serializers.py

rom rest_framework import serializers
from .models import *
class DataSerializer(serializers.ModelSerializer):
class Meta:
model = tbl_data_master

Gist Reference: — https://gist.github.com/poojansmobio/5de67ae7706ab29030461ff04055cb7d


Django has many rich amounts of features that it provides at its best. One of these is Class-Based Views. We’ll be going through a basic example of how to use it for the “DRY” code. In the end, you’ll save a lot of redundant code in your views file.

Requirements


Prerequisites: Must have Docker, Docker-Compose and MySQL 5.7 installed on your system.

Directory Structure:-

|--root
| |-- app
| |--project #This is the Django project
| |--settings.py #This is the main settings file
| |--manage.py
|--.gitignore
|--.env
|-- docker-compose.yml
|-- dockerfile
|-- requirement.txt

Create Database in MySql Local

$ CREATE…

Poojan Shah

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store