Django: SynchronousOnlyOperation: You cannot call this from an async context – use a thread or sync_to_async

The error occurs because Jupyter notebooks has a running event loop. From documentation If you try to run any of these parts from a thread where there is a running event loop, you will get a SynchronousOnlyOperation error. Note that you don’t have to be inside an async function directly to have this error occur. … Read more

Django ImportError: cannot import name ‘render_to_response’ from ‘django.shortcuts’

The render_to_response shortcut was deprecated in Django 2.0, and is removed in Django 3.0. You can use the render shortcut instead, which was added way back in Django 1.3. The render shortcut works similarly to render_to_response, but takes request as its first argument. Change your view as follows: from django.shortcuts import render def index(request): context … Read more

Django TemplateSyntaxError – ‘staticfiles’ is not a registered tag library

If you have any of the following tags in your template: {% load staticfiles %} {% load static from staticfiles %} {% load admin_static %} Then replace it with: {% load static %} You have to make this change because {% load staticfiles %} and {% load admin_static %} were deprecated in Django 2.1, and … Read more