Skip to content
Haritha Bobburi edited this page May 21, 2023 · 4 revisions

django_easyview

Rapidly generate DRF API views for all models in your Django project. Simplifies development, but use with caution in production.

Table of Contents

Django EasyView

The Django DRF Package is a convenient package designed to simplify the integration of Django and Django Rest Framework (DRF). It provides tools and utilities that automate common tasks, such as model registration with the admin site, generation of serializers and viewsets, and setup of URL patterns for API endpoints.

Django DRF Package

Overview

The Django DRF Package is a convenient package designed to simplify the integration of Django and Django Rest Framework (DRF). It provides tools and utilities that automate common tasks, such as model registration with the admin site, generation of serializers and viewsets, and setup of URL patterns for API endpoints.

Installation

To install the Django DRF Package, follow these steps:

  1. Clone the package repository from GitHub.

  2. Copy the drf_easyview folder to your project directory.

  3. Add 'drf_easyview' to the INSTALLED_APPS list in your project's settings file.

  4. Include the package's URLs in your project's urls.py file:

    from django.urls import include, path
    
    urlpatterns = [
        # ... other URL patterns
        path('easyview/', include('drf_easyview.urls')),
    ]

Usage

Once models are created, you can add this package to your Django project to automatically create an OpenAPI for all your models. With the reference provided by the package, you can start creating custom API views based on your business or personal requirements.

Here's how you can use the package to create your custom API views:

  1. Ensure that the Django DRF Package is installed and added to your project as explained in the installation steps.

  2. Start the development server by running the following command:

    python manage.py runserver
  3. Access the OpenAPI documentation for your models by appending /easyview/ to the base URL of your Django project. For example, if your project is running at http://localhost:8000/, the OpenAPI documentation will be available at http://localhost:8000/easyview/.

  4. Explore the available models and their corresponding endpoints in the OpenAPI documentation. This will provide you with the necessary information to create your custom API views.

  5. Based on your requirements, you can create custom API views using Django Rest Framework's class-based views or function-based views. Refer to the Django Rest Framework documentation for detailed instructions on creating custom API views.

    Database Migration

    Before using the package, run the database migration command to create the necessary tables:

    python manage.py migrate

    Starting the Server

    To start the development server and access the APIs provided by your models, use the following command:

    python manage.py runserver

    Accessing the APIs

    Once the server is running, you can access the APIs for your models by appending /easyview/ to the base URL