AttributeError at / 'OrderedDict' object has no attribute 'register' in Django REST framework from quickstart documentation
The version of the markdown
library you have installed is incompatible with the version of Django REST Framework you are using.
Update the markdown
library to at least 3.0 to fix this issue.
Edit: As mentioned in the comments, if you have markdown 3.1 installed, your Python interpreter probably picks up an older version that is installed somewhere else.
You can check which version of markdown your interpreter picks up, by importing it and inspecting markdown.__file__
and markdown.version
.
The most reliable way is probably to add these lines to your settings.py
:
import markdown
print('Markdown module path', markdown.__file__)
print('Markdown version:', markdown.version)
How to get rid of the old module depends on how it got installed in the first place.
The preferred way to avoid these kinds of conflicts is using a virtual environment (or short virtualenv).
The tutorial you linked to uses a virtual environment, so if you followed it step by step, you should not have this problem. Maybe you simply forgot to activate the virtualenv?
Linux/Mac: source env/bin/activate
Windows: env\Scripts\activate
I have the same issue, but poetry
does not allow me to update Markdown
to from 2.6.11 to 3+ because apache-airflow (1.10.10)
depends on markdown (>=2.5.2,<3.0)
I successfully used this workaround declared in settings.py
:
from rest_framework import compat
compat.md_filter_add_syntax_highlight = lambda md: False
Thanks a lot to this redditer