Git Product home page Git Product logo

drf_crud_test_task's Introduction

DRF_CRUD_test_task

Python Django Django Rest Framework

API для CRUD операций на базе Django REST Framework.

Задача

Требуется разработать простое API приложения на Django REST Framework, для работы с которым используются API endpoints по принципу CRUD.

Допустим это будет личный блог, с одной моделью у которой есть поля:

  • пользователь,
  • имя записи,
  • текст,
  • дата создания,
  • опубликована ли запись.

Важно: не использовать ModelViewSet и viewsets, допускается использование generics APIView, но в приоритете базовое APIView.

Желательно, но не обязательно:

  • Предусмотреть права, чтобы только пользователь или администратор мог удалять или изменять запись.
  • Написать тесты для разработанного API.
  • Добавить OpenAPI описание с помощью drf-spectacular.

Стек проекта

  • Python 3.10
  • Django 4.2
  • Django REST Framework 3.14
  • SQLite
  • drf-spectacular
  • pytest

Запуск проекта в dev-режиме

Клонировать репозиторий и перейти в него в командной строке:

git clone https://github.com/dmitrii-r/DRF_CRUD_test_task.git

Установить зависимости из файла requirements.txt:

pip install -r requirements.txt

Перейти в каталог приложения:

cd simple_crud_api

Выполнить миграции:

python3 manage.py migrate

Запустить проект:

python3 manage.py runserver

Документация API

Документация API доступна после запуска проекта по адресам:

  • schema
http://127.0.0.1:8000/api/schema/
  • redoc
http://127.0.0.1:8000/api/schema/redoc/
  • swagger
http://127.0.0.1:8000/api/schema/swagger-ui/

Запуск автоматического тестирования

Ввести команду для запуска тестирования основанного на Pytest:

pytest

drf_crud_test_task's People

Contributors

dmitrii-r avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.