Integration with Django.


  1. Set up Django project.

  2. Create a file (generally called under any project module.

  3. Configure the models and pipelines inside this file.

  4. Add pyot to the INSTALLED_APPS of the project file.

  5. Add the file path of the configuration file to a new variable PYOT_CONFS (list or iterable).


The variable PYOT_CONFS can accept multiple files in case configurations are organized in separated files.


If wsgi is used (unsure about asgi), it is forced to run async views in threads, make sure to use resource managers for graceful handling of resources, refer to Cores -> Resources.

from django.views import View
from asgiref.sync import async_to_sync
from pyot.core.resources import resource_manager

async def function_based_view_using_decorator(request):

async def function_based_view_using_context_manager(request):
    async with resource_manager():

class ClassBasedDecoratedView(View):
    async def get(self, request):

class ClassBasedContextManagedView(View):
    async def get(request):
        async with resource_manager():

Last updated