[Fixed]-Deadlock detected when trying to start server

11👍

I had the same issue, I don’t know yet how to reproduce it and why it’s happening.
But it looks like it’s something related to the new version of Django.

From this comment on the issue it looks like it’s an issue related to .pyc files in the virtual environment.

To fix it this is what I did:

  • Deleted all the .pyc files in the project with this command: find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf

  • Deactivated the virtual environment and reactivate it.

The issue disappeared

5👍

I had the same issue and was unable to reliably reproduce it. I tried removing my .pyc files, but still had the same issues. I moved ‘rest_framework’ to the end of my list of INSTALLED_APPS and that seems to be working for me.

2👍

The error is due to Django Rest Framework, you can check this by removing it and seeing the error disappear.
More specifically, in my case simply removing

from rest_framework.urlpatterns import format_suffix_patterns

from urls.py solved the issue, with Django Rest Framework still installed.

Leave a comment